Skip to main content

Posts

Showing posts from January, 2019

URI problem 1038 solution

Here is the solution to URI problem ID: 1038 #include<stdio.h> int main() {    int x,y;     scanf("%d",&x);     scanf("%d",&y);   if(x==1)   {       printf("Total: R$ %.2lf\n",4.00*y);   }   else if(x==2)   {       printf("Total: R$ %.2lf\n",4.50*y);   }   else if(x==3)   {       printf("Total: R$ %.2lf\n",5.00*y);   }   else if(x==4)   {       printf("Total: R$ %.2lf\n",2.00*y);   }   else   {       printf("Total: R$ %.2lf\n",1.50*y);   }     return 0; }  

URI problem 1037 solution

Here is the solution to URI problem ID: 1037 #include<stdio.h> #include<math.h> int main() {     double n;     scanf("%lf",&n);     if(n>=0&&n<=25)     {         printf("Intervalo [0,25]\n");     }     else if(n>25&&n<=50)     {         printf("Intervalo (25,50]\n");     }     else if(n>50&&n<=75)     {         printf("Intervalo (50,75]\n");     }     else if(n>75&&n<=100)     {         printf("Intervalo (75,100]\n");     }     else     {      printf("Fora de intervalo\n");     }...

URI problem 1018 solution (alternative method 2)

Here is the solution to URI problem ID: 1018 #include<stdio.h> #include<math.h> int main() {     int N,hun=0,fift=0,twent=0,ten=0,five=0,two=0,one=0;     scanf("%d",&N);     if(N>0&&N<1000000)     {     hun=N/100;     fift=((N-(hun*100))/50);     twent=((N-((fift*50)+(hun*100)))/20);     ten=((N-((twent*20)+(fift*50)+(hun*100)))/10);     five=((N-((ten*10)+(twent*20)+(fift*50)+(hun*100)))/5);     two=((N-((five*5)+(ten*10)+(twent*20)+(fift*50)+(hun*100)))/2);     one=((N-((two*2)+(five*5)+(ten*10)+(twent*20)+(fift*50)+(hun*100)))/1);     printf("%d\n",N);     printf("%d nota(s) de R$ 100,00\n",hun);     printf("%d nota(s) de R$ 50,00\n",fift);     printf("%d nota(s) de R$ 20,00\n",twent);     printf("%d nota(s) de R$ ...

URI problem 1018 solution (alternative method 1)

Here is the solution to URI problem ID: 1018 #include<stdio.h> int main() {     int i,j,N;     int ar[7]= {100,50,20,10,5,2,1};     int br[7];     scanf("%d",&N);     printf("%d\n",N);     for(i=0; i<7; i++)     {         br[i]=N/ar[i];         N=N%ar[i];     }     for(j=0; j<7; j++)     {         printf("%d nota(s) de R$ %d,00\n",br[j],ar[j]);     } return 0; }

URI problem 1018 solution

Here is the solution to URI problem ID: 1018 #include<stdio.h> int main() {     int N,hun=0,fift=0,twent=0,ten=0,five=0,two=0,one=0;     scanf("%d",&N);     printf("%d\n",N);     if(N>0&&N<1000000)     {     hun=N/100;     fift=((N%100)/50);     twent=(((N%100)%50)/20); ;     ten=((((N%100)%50)%20)/10);     five=(((((N%100)%50)%20)%10)/5);     two=((((((N%100)%50)%20)%10)%5)/2);     one=(((((((N%100)%50)%20)%10)%5)%2)/1);     printf("%d nota(s) de R$ 100,00\n",hun);     printf("%d nota(s) de R$ 50,00\n",fift);     printf("%d nota(s) de R$ 20,00\n",twent);     printf("%d nota(s) de R$ 10,00\n",ten);     printf("%d nota(s) de R$ 5,00\n",five);     printf("%d nota(s) de R$ 2,0...

URI problem 1035 solution

Here is the solution to URI problem ID: 1035 #include<stdio.h> int main() {     int A,B,C,D;     scanf("%d %d %d %d",&A,&B,&C,&D);     if(B>C&&D>A&&(C+D)>(A+B)&&C>0&&D>0&&A%2==0)     {         printf("Valores aceitos\n");     }     else     {         printf("Valores nao aceitos\n");     }     return 0; }

URI problem 1020 solution

Here is the solution to URI problem ID: 1020 #include<stdio.h> int main() {     int N,y=0,m=0,d=0,k,n;     scanf("%d",&N);     y=(N/365);     n=N%365;     m=n/30;     k=(n-m*30);     d=k;     printf("%d ano(s)\n",y);     printf("%d mes(es)\n",m);     printf("%d dia(s)\n",d);     return 0; }

URI problem 1019 solution

    Here is the solution to URI problem ID: 1019 #include<stdio.h> int main() {     int N,h,m,s;     scanf("%d",&N);     h=(N/3600);     m=((N/60)-(h*60));     s=(N-((h*60*60)+(m*60)));     printf("%d:%d:%d\n",h,m,s);     return 0; }

URI problem 1015 solution

Here is the solution to URI problem ID: 1015 #include<stdio.h> #include<math.h> int main() {     double x1,x2,y1,y2,distance;     scanf("%lf%lf",&x1,&y1);     scanf("%lf%lf",&x2,&y2);     distance=(sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1))));     printf("%.4lf\n",distance);     return 0; }

URI problem 1013 solution

Here is the solution to URI problem ID: 1013 #include<stdio.h> #include<math.h> int main() {     int A,B,C,s,r;     scanf("%d %d %d",&A,&B,&C);     s=(((A+B)+abs(A-B))/2);     r=(((s+C)+abs(s-C))/2);     printf("%d eh o maior\n",r);     return 0; }

URI problem 1012 solution

Here is the solution to URI problem ID:1012 #include<stdio.h> #include<math.h> #define pi 3.14159 int main() {     double A,B,C,TRIANGULO,CIRCULO,TRAPEZIO,QUADRADO,RETANGULO;     scanf("%lf %lf %lf",&A,&B,&C);     TRIANGULO=0.5*A*C;     CIRCULO=pi*C*C;     TRAPEZIO=0.5*((A+B)*C);     QUADRADO=B*B;     RETANGULO=A*B;     printf("TRIANGULO: %.3lf\n",TRIANGULO);     printf("CIRCULO: %.3lf\n",CIRCULO);     printf("TRAPEZIO: %.3lf\n",TRAPEZIO);     printf("QUADRADO: %.3lf\n",QUADRADO);     printf("RETANGULO: %.3lf\n",RETANGULO);     return 0; }

URI problem 1011 solution

 Here is the solution to URI problem ID: 1011 #include<stdio.h> #include<math.h> #define pi 3.14159 int main() {     double V, R;     scanf("%lf",&R);     V=((4.0/3)*pi*R*R*R);     printf("VOLUME = %.3lf\n",V);     return 0; }

URI problem 1010 solution

  Here is the solution to URI problem ID: 1010 #include<stdio.h> #include<math.h> int main() {     int c1,c2,n1,n2;     double p1,p2,totsy;     scanf("%d %d %lf",&c1,&n1,&p1);     scanf("%d %d %lf",&c2,&n2,&p2);     totsy=((n1*p1)+(n2*p2));     printf("VALOR A PAGAR: R$ %.2lf\n",totsy);     return 0; }

URI problem 1009 solution

Here is the solution to URI problem ID 1009 #include<stdio.h> #include<math.h> int main() { char name[20]; scanf("%s",&name); double salary, profit,total; scanf("%lf%lf",&salary,&profit); total=(((15.00/100)*(profit))+salary); printf("TOTAL = R$ %.2lf\n",total); return 0; }

URI problem 1008 solution

Here is the solution to URI problem ID: 1008 #include<stdio.h> #include<math.h> int main() {     int n,h;     double a,t;     scanf("%d %d %lf",&n,&h,&a);     t=(h*a);     printf("NUMBER = %d\nSALARY = U$ %.2lf\n",n,t);     return 0; }

URI problem 1007 solution

Here is the solution to URI problem ID: 1007   #include<stdio.h> #include<math.h> int main() {     int A,B,C,D,DIFERENCA;     scanf("%d %d %d %d",&A,&B,&C,&D);     DIFERENCA=((A*B)-(C*D));     printf("DIFERENCA = %d\n",DIFERENCA);     return 0; }  

URI problem 1006 solution

Here is the solution to URI problem ID: 1006 #include<stdio.h> #include<math.h> int main() {     double A,B,C,t;     scanf("%lf %lf %lf",&A,&B,&C);     t=(((A/10)*2)+((B/10)*3)+((C/10)*5));     printf("MEDIA = %.1lf\n",t);     return 0; }

URI problem 1005 solution

Here is the solution to URI problem ID: 1005 #include<stdio.h> #include<math.h> int main() {     double A,B,t;     scanf("%lf %lf",&A,&B);     t=(((((A/10)*3.5)+((B/10)*7.5))/11)*10);     printf("MEDIA = %.5lf\n",t);     return 0; }

URI Problem 1002 solution

Here is the solution to URI problem ID 1002 #include<stdio.h> #include<math.h> #include<stdlib.h> #define pi 3.14159 int main() {     double A, R;     scanf("%lf",&R);     A=pi*R*R;     printf("A=%.4lf\n",A);     return 0; }