ABSYS

ABSYS


#include<iostream>
#include<cstring>
#include<cstdlib>

using namespace std;

int main()
{
    int t;
    char str1[100],str2[100],opr[2],opr1[2],str5[100];
   
    cin>>t;
   
    for(int i=0;i<t;i++)
    {
    cin>>str1>>opr>>str2>>opr1>>str5;
   
        if((strchr(str1,'m'))!=NULL)
      
        {
                           int y=atoi(str2);
                           int z=atoi(str5);
                           int l=z-y;
                         
                         cout<<l<<" + "<<y<<" = "<<z<<endl;
                                 }
           else if ((strchr(str2,'m'))!=NULL)
           {
            
                           int y=atoi(str1);
                           int z=atoi(str5);
                           int l=z-y;
                          cout<<y<<" + "<<l<<" = "<<z<<endl;
               
          }
            else if ((strchr(str5,'m'))!=NULL)
            {
                           int y=atoi(str1);
                           int z=atoi(str2);
                           int l=z+y;
                       
                           cout<<y<<" + "<<z<<" = "<<l<<endl;
                 }
            }
    return 0;
   
    }



ABCD1

ABCD1

#include<stdio.h>
int main()
{
 int arr[]={2, 4, 9, 16, 25, 64, 289, 729, 1681, 2401, 3481, 4096, 5041, 7921, 10201, 15625, 17161, 27889, 28561, 29929, 65536, 83521, 85849, 146689, 262144, 279841, 458329, 491401, 531441, 552049, 579121, 597529, 683929, 703921, 707281, 734449, 829921,1190281 }; 
 int t;   
 scanf("%d",&t);
 int a,b;
 while(t--)
 {
         
 scanf("%d%d",&a,&b);
         int a1 = 0,a2=0;
         while(arr[a1++]<a);
         while(arr[a2++]<b);
         printf("%d\n",a2-a1); 
 }  
 return 0;
}

ABCD

ABCD

#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>

using namespace std;

int main()
{
                 
          int n;
          cin>>n;
          string name;
          cin>>name;
          char ans[2*n+1];int ct = 0;
          for(int i=0;i<2*n;i++)
          {
                    int yy[4] = {0};
                    yy[name[i]-'A']++;
                    i++;
                    yy[name[i]-'A']++;
                    int wait;int flag = 0;
                    for(int j=0;j<4;j++)
                    {
                              if(yy[j]==0 && i==1)
                              {
                                        cout<<char('A'+j);
                                        ans[ct++] = 'A'+j;         
                              }         
                              else if(yy[j]==0)
                              {
                                        if(ans[ct-1]==('A'+j) && flag==0){flag = 1;wait = j;goto ny;}
                                        if(flag==0)
                                        {
                                                  cout<<char('A'+j);         
                                                  ans[ct++] = 'A'+j;
                                        }
                                        else
                                             {     cout<<char('A'+j)<<char('A'+wait);
                                                  ans[ct++] = 'A'+j;
                                                  ans[ct++] = 'A'+wait;
                                           }
                                           ny:;
                              }         
                    }
                   // cout<<endl;
          }
          cout<<endl;
          //system("pause");
          return 0;
}



SILVER

SILVER

#include<iostream.h>
#include<cmath>
main()
{
int t,res;
cin>>t;
while(t!=0)
{
    res=0;
    int m=0,r=0;
while(m<t)
{
m+=pow(2,r++);         
}          
cout<<r-1<<endl;
cin>>t;          
}     
     
}

MAYA

MAYA

#include<stdio.h>
int main()
{
long long int result=0;
char temp;
int n,t;
int count;
scanf("%d%c",&n,&temp);
while(n!=0)
{
result=0;
t=n;
while(t>0)
{
scanf("%c",&temp);
count=0;
while(temp!='\n')
{
if(temp=='S')count+=0;
else if(temp=='.')count+=1;
else if(temp=='-')count+=5;
scanf("%c",&temp);
}
if(t==1)
result+=count;
else if(t==2)result+=count*20;
else if(t==3)result+=count*360;
else if(t==4)result+=count*7200;
else if(t==5)result+=count*144000;
else if(t==6)result+=count*2880000;
else if(t==7)result+=count*57600000;
t--;
}
printf("%lld\n",result);
scanf("%d%c",&n,&temp);
}
return 0;
}


BILLIARD

BILLIARD

#include<iostream.h>
#include<cmath>
main()
{
double a,b,s,m,n;
double vx,vy,pi=2*acos(0);
cin>>a>>b>>s>>m>>n;
while(a!=0)
{
vx=m*a/s;
vy = n*b/s;
printf("%.2lf %.2lf\n",atan(vy/vx)*180/pi,sqrt(vx*vx+vy*vy));
    cin>>a>>b>>s>>m>>n;      
}      }

TAP2013G

TAP2013G
#include <iostream>
#include<algorithm>
using namespace std;

int main() {
    int s,count=0;
    cin>>s;
    int n[100001],q[100001];
    for(int i=0;i<s;i++)
    {
        cin>>q[i];
    }
    for(int i=0;i<s;i++)
    {
        cin>>n[i];
    }
    sort(q,q+s);
    sort(n,n+s);
    for(int i=0,j=0;i<s&&j<s;)
    {
        if(q[i]<n[j])
        {
            count++;
            i++;
            j++;
        }
        else if(q[i]==n[j])
        {
            j++;
        }
        else
        j++;
       
    }
    cout<<count<<endl;
   
    return 0;
}
simple and easy problems , u only need to give victory any how to alogonia army.

AP2

AP2

#include<iostream>
using namespace std;

int main()
{
    int t;
    cin>>t;
    long long int a,b,s;
    while(t--)
    {
              cin>>a>>b>>s;
             long long int n = (s*2)/(a+b);
             long long int d = (b-a)/(n-5);
             long long int f = a-(2*d);
              cout<<n<<endl;
              for(long long int i=0;i<n;i++)
               cout<<f+(i*d)<<" ";
              cout<<endl;
    }   
   
    return 0;
}

AP3

AP3

#include<stdio.h>
#include<math.h>

int main()
{
    int t; scanf("%d",&t);
    while(t--)
    {
       long long int a3,a3l,s,i,a,d,len; 
          
      long double n,sq,diff;
      scanf("%lld",&a3);
      scanf("%lld",&a3l);
      scanf("%lld",&s);
     
      sq=sqrtl(((5.0*a3l+7.0*a3+2.0*s)*(5.0*a3l+7.0*a3+2.0*s))-(48.0*(a3l+a3)*s));
      n=((5.0*a3l+7.0*a3+2.0*s)+sq)/(2.0*(a3l+a3));
     
      len=llrintl(n);
      printf("%lld\n",len);
     
      diff=(a3l-a3)/(len-6.0);
      d=llrintl(diff);
     
      a=(a3-(2*d));
     
  
  
      
       
      for(i=0;i<len;i++)
       {
                       printf("%lld ",a+i*d);
       }
        printf("\n");
      
      
       }  
     
     return 0;
}