Monday, November 7, 2016

Uri 2029 - Honey Reservoir

#include <stdio.h>
#define PI 3.14
int main()
{
double v, r, h, d, a;
int tmp;
while(scanf("%lf %lf", &v, &d)!=EOF)
{
r = d/2;
a = PI*r*r;
h = v/a;
printf("ALTURA = %.2lf\n",h);
printf("AREA = %.2lf\n",a);
}
return 0;
}

Saturday, November 5, 2016

devskills-Banglawash

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t_f1r,t_s1r,t_f2r,t_s2r,f1_r1,f1_r2,s1_r1,s1_r2,f2_r1,f2_r2,s2_r1,s2_r2,n;
cin>>n;
while(n--){
t_f1r = t_f2r = t_s1r = t_s2r = 0;
cin>>f1_r1>>f1_r2>>s1_r1>>s1_r2;
cin>>f2_r1>>f2_r2>>s2_r1>>s2_r2;
t_f1r = f1_r1+f1_r2,t_s1r=s1_r1+s1_r2,t_f2r=f2_r1+f2_r2,t_s2r=s2_r1+s2_r2;
if(t_f1r > t_s1r && t_f2r > t_s2r) cout<<"Banglawash\n";
else cout<<"Miss\n";
}
return 0;
}

Friday, November 4, 2016

Uri 1015 - Distance between two points

#include
#include

int main()
{
    double x1,x2,y1,y2,root;

    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    root= sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));

    printf("%.4f\n",root);

    return 0;
}

 

Uri 1011 - Sphere

#include

int main()
{
    int R;
    double r;
    scanf("%d",&R);

    r=(4.0/3)*3.14159*R*R*R;

    printf("VOLUME = %.3f\n",r);

    return 0;
}

Uri 2157 - Mirror Sequence

#include

int main() {
    int n,m,i,j,t;
    char ss[101] ;
scanf("%d",&t);
    while(t--){
        scanf("%d %d",&n,&m);
        for(i=n;i<=m;i++)printf("%d",i);
        for(i=m;i>=n;i--){
            sprintf( ss, "%d", i );
             for( j = strlen(ss)-1;j>=0;j--) printf("%c",ss[j]);
        }
        printf("\n");
    }
    return 0;
}

Uri 1006 - Average 2

#include

int main(){
float a,b,c,result;
scanf("%f %f %f",&a,&b,&c);
result=((a*2)+(b*3)+(c*5))/(2+3+5);
printf("MEDIA = %.1f\n",result);
return 0;
}


Uri 1005 - Average 1

#include
int main(){
float a,b,result;
scanf("%f %f",&a,&b);
result=((a*3.5)+(b*7.5))/(3.5+7.5);
printf("MEDIA = %.5f\n",result);
return 0;
}

Uri 1008 - Salary

#include

int main()
{
    int A;
    double b, c,d;


    scanf("%d",&A);
    scanf("%lf %lf",&b,&c);

    d=b*c;

    printf("NUMBER = %d",A);
    printf("\nSALARY = U$ %.2f\n",d);

    return 0;
}

Uri 1010 - Simple Calculate

#include

int main()
{
    int a1,b1,a2,b2;
    double c1,d1,c2,d2;

    scanf("%d %d %lf",&a1,&b1,&c1);
    d1=b1*c1;

    scanf("%d %d %lf",&a2,&b2,&c2);
    d2=b2*c2;

    printf("VALOR A PAGAR: R$ %.2f\n",d1+d2);

    return 0;

}

Uri 1009 - Salary with Bonus

#include

int main()
{
    char n;
    double a,b,total;

    scanf("%s %lf %lf",&n,&a,&b);

    total=(b*15)/100;

    printf("TOTAL = R$ %.2lf\n",total+a);

    return 0;
}

Uri 1002 - Area of a Circle

#include

int main(){
    double R,A;

    scanf("%lf",&R);

    A=3.14159*R*R;

    printf("A=%.4lf\n",A);

    return 0;
}

Uri 1007 Difference

#include

int main()
{
    int A,B,C,D,X,Y;

    scanf("%d %d %d %d",&A,&B,&C,&D);

    X=A*B;
    Y=C*D;

    printf("DIFERENCA = %d\n",X-Y);

    return 0;
}

Uri 1004 - Simple Product

#include

int main()
{
    int A,B;
    scanf("%d %d",&A,&B);

    printf("PROD = %d\n",A*B);

    return 0;

}

Uri 1003 - Simple Sum

#include

int main()
{
    int A,B;
    scanf("%d %d",&A,&B);

    printf("SOMA = %d\n",A+B);

    return 0;

}

Uri 1001 - Extremely Basic

#include

int main() {

    int A,B,X;
    scanf("%d %d",&A,&B);
    X=A+B;

    printf("X = %d\n",X);

    return 0;
}

Thursday, November 3, 2016

Uri 2310 - Volleyball

#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
        double s,b,a,s1,b1,a1,t_s=0,t_b=0,t_s1=0,k=0,t_b1=0,k1=0;
        float s_ans,b_ans,a_ans;
        string name;
         cin>>n;
         while(n--){
            cin>>name>>s>>b>>a;
            cin>>s1>>b1>>a1;
                t_s  += s;
                t_s1 += s1;
                    t_b += b;
                    t_b1 += b1;
                    k += a;
                    k1 += a1;

         }
         s_ans = (t_s1*100)/t_s;
         b_ans = (t_b1*100)/t_b;
         a_ans = (k1*100)/k;
         cout<<fixed<<setprecision(2)<<"Pontos de Saque: "<<s_ans<<" %."<<endl;
         cout<<fixed<<setprecision(2)<<"Pontos de Bloqueio: "<<b_ans<<" %."<<endl;
         cout<<fixed<<setprecision(2)<<"Pontos de Ataque: "<<a_ans<<" %."<<endl;

    return 0;
}

Uri 2235 - Walking in Time

#include<bits/stdc++.h>
using namespace std;

int main(){
        int f,v,p;
          cin>>f>>v>>p;
        if(f == p  ||  v == p  ||  f == v  ||  f+v == p  ||  v+p == f  ||  f+p == v)
            cout<<"S"<<endl;
        else
            cout<<"N"<<endl;

    return 0;
}

Uri 2242 - Huaauhahhuahau

/*                                                    CODEMAN
                                                ARIF KHAN NIHAR
                                           Uri 2242 - Huaauhahhuahau
                                                    date -> 1/11/2016

                                            */
#include<bits/stdc++.h>
using namespace std;
bool check_vowel(char ch){
    switch(ch){
        case 'a': return true;
        break;
        case 'e': return true;
        break;
        case 'i': return true;
        break;
        case 'o': return true;
        break;
        case 'u': return true;
        break;
        default : return false;
    }
}
int main(){
      string s,s1,s2;
      cin>>s;
      for(int i = 0;i<s.size();i++){
        if(check_vowel(s[i]))
            s1 += s[i];
      }
      s2 = s1;
      reverse(s2.begin(),s2.end());
      if(s1 == s2)
      cout<<"S"<<endl;
      else
         cout<<"N"<<endl;
    return 0;
}

Uri 2232 - Pascal's Triangle

#include<bits/stdc++.h>
using namespace std;

int main(){
    int  i,j,ca,p=0;
     int sum[32][32];
     sum[1][0] = 1,sum[2][0] = 1, sum[2][1] = 1;

    cin>>ca;
    while(ca--){
          int ans = 3,val;  p = 0;
          cin>>val;
          if(val == 1)ans = 1;
          else if(val == 2) ans = 3;
          else{
     for(i = 3; i<=val ; i++){
        sum [i][0] = 1;
        ans += sum[i][0];
    for(j=1 ; j< i-1 ; j++){
        sum[i][j]  = sum[i-1][j-1] + sum[i-1][j];

        ans += sum[i][j];
    }
   sum[i][j] = 1;
   ans += 1;
}
          }
  cout<<ans<<endl;
}
    return 0;
}

Monday, September 26, 2016

UVA 11462-AGE SORT

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,a,i,j,t=0;
    int *ar = new int[2000001];
    int *br = new int[2000001];
    while(cin>>n && n)
    {
        t = 0;
        for (i = 1;i<=n;i++){
            cin >> a;
            ar[a]=ar[a]+1;
        }
    for(i=1;i<=n;i++)
        if(ar[i]>0)
                for(j=1;j<=ar[i];j++,t++)
                    br[t]=i;

         for(i=1;i<=n;i++)
            if(ar[i]>0)
                for(j=1;j<=ar[i];j++) ar[i]=0;

        for(i = 0;i<t;i++){
            if(i>0)cout<<" ";
                cout<<br[i];
        }
        cout<<endl;
    }
     delete []ar;
    return 0 ;
}