Download - Problemas Resolvidos Do URI

Transcript

PROBLEMAS DO URI================================1001 - Extremamente bsico=================================#include int main (){int a, b, x;scanf ("%d", &a);scanf ("%d", &b);x=a+b;printf("X = %d\n", x);return 0;}==================================1002 - rea do crculo==================================#include int main (){double Pi = 3.14159;double raio, area;scanf ("%lf", &raio);area = PI*raio*raio;printf ("A=%.4lf\n",area);return 0;}====================================1003 - Soma simples====================================#include int main (){int A,B,SOMA;scanf ("%d",&A);scanf ("%d",&B);SOMA = A + B;printf ("SOMA = %d\n", SOMA);return 0;}====================================1004 - Produto simples====================================#include int main (){int A,B,PROD;scanf ("%d",&A);scanf ("%d",&B);PROD = A * B;printf ("PROD = %d\n", PROD);return 0;}====================================1005 - Mdia 1====================================#include int main (){double A, B, MEDIA;scanf ("%lf", &A);scanf ("%lf", &B);MEDIA = (3.5*A+7.5*B)/11.0;printf ("MEDIA = %0.5lf\n", MEDIA);return 0;}====================================1006 - Mdia 2====================================#include int main (){double A, B, C, MEDIA;scanf ("%lf", &A);scanf ("%lf", &B);scanf ("%lf", &C);MEDIA = (2.0*A+3.0*B+5.0*C)/10.0;printf ("MEDIA = %0.1lf\n", MEDIA);return 0;}===================================1007 - Diferena====================================#include int main (){int A, B, C, D, DIFERENCA;scanf ("%d", &A);scanf ("%d", &B);scanf ("%d", &C);scanf ("%d", &D);DIFERENCA = (A*B-C*D);printf ("DIFERENCA = %d\n", DIFERENCA);return 0;}====================================1008 - Salrio====================================#include int main (){int NUMBER, HORAS;double VALOR, SALARY;scanf ("%d", &NUMBER);scanf ("%d", &HORAS);scanf ("%lf", &VALOR);SALARY = (double) HORAS * VALOR;printf ("NUMBER = %d\n", NUMBER);printf ("SALARY = U$ %0.2lf\n", SALARY);return 0;}=====================================1009 - Salrio com bnus====================================#include int main (){char nome [100];double fixo,vendas;scanf ("%s", nome);scanf ("%lf", &fixo);scanf ("%lf", &vendas);printf ("TOTAL = R$ %0.2lf\n",fixo+vendas*0.15);return 0;}======================================1010 - Clculo simples======================================#include int main (){int cod1, cod2, num1, num2;double valor1, valor2;scanf ("%d", &cod1);scanf ("%d", &num1);scanf ("%lf", &valor1);scanf ("%d", &cod2);scanf ("%d", &num2);scanf ("%lf", &valor2);printf ("VALOR A PAGAR: R$ %0.2lf\n", (num1*valor1) + (num2*valor2));return 0;}=====================================1011 - Esfera=====================================#include int main (){int R;double PI;PI = 3.14159;scanf ("%d", &R);printf ("VOLUME = %0.3lf\n", (4.0/3)*PI*R*R*R);return 0;}=====================================1012 - rea=====================================#include int main (){double A, B, C, PI;PI = 3.14159;scanf ("%lf", &A);scanf ("%lf", &B);scanf ("%lf", &C);printf ("TRIANGULO: %0.3lf\n", A * C / 2);printf ("CIRCULO: %0.3lf\n", PI * C * C);printf ("TRAPEZIO: %0.3lf\n", (A + B) * C / 2);printf ("QUADRADO: %0.3lf\n", B * B);printf ("RETANGULO: %0.3lf\n", A * B); return 0;}=====================================1013 - Maior =====================================#include int main () { int tmp, maior; scanf ("%d", &maior); scanf ("%d", &tmp); if(tmp > maior) maior = tmp; scanf ("%d", &tmp); if(tmp > maior) maior = tmp; printf ("%d eh o maior\n", maior); return 0;}=======================================1014 - Consumo - No resolvido=======================================#include main (){int x;double consumo, y;scanf ("%d", &x);scanf ("%lf", &y);consumo = x/y;printf (consumo, "%0.3lf\n", "km/l")return 0}========================================1059 - Nmeros pares=======================================#include int main () {int i;for (i = 2; i