├── SQL ├── 2602.sql ├── 2608.sql ├── 2607.sql ├── 2604.sql ├── 2603.sql └── README.md ├── 1021.c ├── 1087.c ├── 1547.c ├── 1123.cpp ├── 1237.cpp ├── 1260.cpp ├── 1273.cpp ├── 1524.cpp ├── 2095.cpp ├── 1059.c ├── 1153.c ├── 1001.cpp ├── 1003.cpp ├── 1095.c ├── 1004.c ├── 1016.cpp ├── 1005.c ├── 1073.c ├── 1075.c ├── 1078.c ├── 1924.c ├── 1959.c ├── 2483.c ├── 1011.c ├── 1014.c ├── 1144.c ├── 1759.c ├── 1044.c ├── 1006.c ├── 2232.c ├── 1019.c ├── 1564.c ├── 1046.c ├── 1070.c ├── 1113.c ├── 1114.c ├── 1172.c ├── 1174.c ├── 1007.c ├── 1013.c ├── 1080.c ├── 1096.c ├── 1002.cpp ├── 1017.c ├── 2006.cpp ├── 1143.c ├── 1589.c ├── 1008.c ├── 1441.cpp ├── 1079.c ├── 1009.c ├── 1116.c ├── 1060.c ├── 1175.c ├── 1142.c ├── 1010.c ├── 1035.c ├── 1161.cpp ├── 1216.cpp ├── 1020.c ├── 1234.cpp ├── 1015.c ├── 1661.cpp ├── 1115.c ├── 1064.c ├── 1180.c ├── 1192.cpp ├── 1067.c ├── 1117.c ├── 1030.cpp ├── 1134.c ├── 1245.cpp ├── 1037.cpp ├── 1042.c ├── 1036.c ├── 2235.cpp ├── 1332.cpp ├── 1234.c ├── 1091.cpp ├── 1985.cpp ├── 2060.c ├── 2484.cpp ├── 1581.cpp ├── 1038.c ├── 1074.c ├── 1768.cpp ├── 1012.c ├── 1061.cpp ├── 1068.cpp ├── 1140.cpp ├── 1050.c ├── 1069.cpp ├── 1051.c ├── 1104.cpp ├── 1052.c ├── 1221.cpp ├── 1018.c ├── 1654_2.cpp ├── 1211.cpp ├── 1183.c ├── 1184.c ├── 1168.cpp ├── 2059.cpp ├── 1222_2.cpp ├── 1245.c ├── 2334.java ├── 1049.c ├── 1222.cpp ├── 1103.cpp ├── 1396.cpp ├── 2031.c ├── 1152.cpp ├── 1048.c ├── 1419.cpp ├── 1905.cpp ├── README.md └── 1514.cpp /SQL/2602.sql: -------------------------------------------------------------------------------- 1 | SELECT name FROM customers WHERE state = 'RS'; -------------------------------------------------------------------------------- /SQL/2608.sql: -------------------------------------------------------------------------------- 1 | SELECT MAX(Price), MIN(Price) FROM Products; -------------------------------------------------------------------------------- /SQL/2607.sql: -------------------------------------------------------------------------------- 1 | select distinct city from providers order by city asc ; -------------------------------------------------------------------------------- /SQL/2604.sql: -------------------------------------------------------------------------------- 1 | SELECT id, name FROM products WHERE price < 10 OR price > 100; -------------------------------------------------------------------------------- /1021.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WellersonPrenholato/URI-Beecrowd/HEAD/1021.c -------------------------------------------------------------------------------- /1087.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WellersonPrenholato/URI-Beecrowd/HEAD/1087.c -------------------------------------------------------------------------------- /1547.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WellersonPrenholato/URI-Beecrowd/HEAD/1547.c -------------------------------------------------------------------------------- /SQL/2603.sql: -------------------------------------------------------------------------------- 1 | SELECT name, street FROM public.customers WHERE city = 'Porto Alegre'; -------------------------------------------------------------------------------- /1123.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WellersonPrenholato/URI-Beecrowd/HEAD/1123.cpp -------------------------------------------------------------------------------- /1237.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WellersonPrenholato/URI-Beecrowd/HEAD/1237.cpp -------------------------------------------------------------------------------- /1260.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WellersonPrenholato/URI-Beecrowd/HEAD/1260.cpp -------------------------------------------------------------------------------- /1273.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WellersonPrenholato/URI-Beecrowd/HEAD/1273.cpp -------------------------------------------------------------------------------- /1524.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WellersonPrenholato/URI-Beecrowd/HEAD/1524.cpp -------------------------------------------------------------------------------- /2095.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WellersonPrenholato/URI-Beecrowd/HEAD/2095.cpp -------------------------------------------------------------------------------- /1059.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int n; 5 | for (n=2; n <= 100; n = n+2){ 6 | printf("%d\n", n); 7 | } 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /1153.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | int n,f=1; 5 | 6 | scanf("%d", &n); 7 | 8 | for(;n>0 && n<13;--n){ 9 | f= f*n; 10 | } 11 | printf("%d\n",f); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /1001.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | int a, b, x; 7 | 8 | cin >> a >>b; 9 | x = a + b; 10 | 11 | cout << "X = "<< x < 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | int a, b, x; 7 | 8 | cin >> a >>b; 9 | x = a + b; 10 | 11 | cout << "SOMA = "<< x < 2 | 3 | int main() { 4 | 5 | int i, j=60; 6 | 7 | for(i=1;i<40;i+=3){ 8 | printf("I=%d J=%d\n",i,j); 9 | j-=5; 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /1004.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int a,b,PROD; 5 | 6 | scanf("%d",&a); 7 | scanf("%d",&b); 8 | 9 | PROD = a * b; 10 | 11 | printf("PROD = %d\n",PROD); 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /1016.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main (){ 4 | int x, resultado; 5 | 6 | cin >> x; 7 | resultado = x *2; 8 | 9 | cout << resultado << " minutos"< 2 | 3 | int main(){ 4 | float A, B, MEDIA; 5 | 6 | scanf("%f",&A); 7 | scanf("%f",&B); 8 | 9 | MEDIA = (A*3.5+B*7.5)/11; 10 | 11 | printf("MEDIA = %.5f\n", MEDIA); 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /1073.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | int num, i; 5 | 6 | scanf("%d",&num); 7 | 8 | for(i=1; i<= num;i++){ 9 | if (i % 2 == 0){ 10 | printf("%d^2 = %d\n",i, i*i); 11 | } 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /1075.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main (){ 5 | int n; 6 | int i; 7 | 8 | scanf("%d", &n); 9 | 10 | for (i=0; i< 10000; i++){ 11 | if (i % n == 2){ 12 | printf("%d\n", i); 13 | } 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /1078.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int i,num,res; 5 | 6 | scanf("%d",&num); 7 | 8 | for (i=1; i<=10; i++) 9 | { 10 | printf("%d x %d = %d\n",i,num,num*i); 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /1924.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main (){ 5 | int i, n; 6 | char s[100]; 7 | 8 | scanf("%d", &n); 9 | 10 | for(i=0; i<=n;i++){ 11 | gets(s); 12 | } 13 | 14 | printf("Ciencia da Computacao\n"); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /1959.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main (){ 5 | unsigned int n, l, resultado; 6 | 7 | scanf("%u",&n); 8 | scanf("%u",&l); 9 | 10 | resultado = n * l; 11 | 12 | printf("%u\n", resultado); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /2483.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (){ 5 | int num, i; 6 | 7 | scanf("%d",&num); 8 | printf("Feliz nat"); 9 | for(i=0; i 2 | #include 3 | 4 | int main(){ 5 | double r, v, pi ; 6 | 7 | pi = 3.14159; 8 | scanf("%lf", &r); 9 | 10 | v = (4/3.0)*3.14159*pow(r,3); 11 | 12 | printf("VOLUME = %.3lf\n", v); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /1014.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int dist; 5 | float combust, result; 6 | 7 | scanf("%d", &dist); 8 | scanf("%f", &combust); 9 | 10 | result = (dist / combust); 11 | 12 | printf("%.3f km/l\n", result); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /1144.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int i, j; 5 | int n; 6 | scanf("%d", &n); 7 | 8 | for(i=1; i<=n; i++){ 9 | printf("%d %d %d\n", i, i*i, (i*i*i)); 10 | printf("%d %d %d\n", i, (i*i)+1, (i*i*i)+1); 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /1759.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int i; 5 | long int a; 6 | scanf("%d", &a); 7 | for (i=0; i<(a-1); i++){ 8 | printf("Ho "); 9 | } 10 | if (a>0){ 11 | printf("Ho!\n"); 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /1044.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a, b; 5 | 6 | scanf ("%d %d", &a, &b); 7 | 8 | if (a % b == 0 || b % a == 0){ 9 | printf("Sao Multiplos\n"); 10 | } 11 | else{ 12 | printf("Nao sao Multiplos\n"); 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /1006.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | float A, B, C; 5 | double MEDIA; 6 | 7 | scanf("%f",&A); 8 | scanf("%f",&B); 9 | scanf("%f",&C); 10 | 11 | MEDIA = (A*2+B*3+C*5)/10; 12 | 13 | printf("MEDIA = %.1f\n", MEDIA); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /2232.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (){ 5 | int i, num; 6 | long int a, x; 7 | scanf("%d",&num); 8 | 9 | for (i=0; i 2 | 3 | int main (){ 4 | 5 | int N, hora, min, seg; 6 | 7 | scanf("%d", &N); 8 | 9 | hora = N/3600; 10 | min = (N-(hora*3600))/60; 11 | seg = N-((hora*3600)+(min*60)); 12 | 13 | printf("%d:%d:%d\n", hora, min, seg); 14 | 15 | return 0; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /1564.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | int entrada; 5 | 6 | while (scanf("%d",&entrada) != EOF){ 7 | if (entrada == 0){ 8 | printf("vai ter copa!\n"); 9 | }else if (entrada > 0){ 10 | printf("vai ter duas!\n"); 11 | } 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /1046.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int i,j,x; 6 | 7 | scanf("%d%d",&i,&j); 8 | x = 24-i+j; 9 | if(x > 24) 10 | x = abs(24 - (24-i+j)); 11 | printf("O JOGO DUROU %d HORA(S)\n",x); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /1070.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int n,partida, i; 6 | 7 | scanf("%d", &partida); 8 | 9 | for(i=partida; i< partida + 12; i++){ 10 | if (i % 2 != 0){ 11 | printf("%d\n", i); 12 | 13 | } 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /1113.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | int A, B; 5 | 6 | while (A!=B){ 7 | scanf("%d", &A); 8 | scanf("%d", &B); 9 | if (A > B){ 10 | printf("Decrescente\n"); 11 | }else if ( B > A){ 12 | printf("Crescente\n"); 13 | } 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /1114.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int num, senha= 2002; 5 | 6 | while(num != senha){ 7 | scanf("%d", &num); 8 | if (num == 2002){ 9 | printf("Acesso Permitido\n"); 10 | }else{ 11 | printf("Senha Invalida\n"); 12 | } 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /1172.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | int x[10], i, y=0; 5 | 6 | for (i=0; i<10; i++){ 7 | scanf("%d", &x[i]); 8 | if (x[i]> 0){ 9 | printf("X[%d] = %d\n", y++, x[i]); 10 | }else { 11 | printf("X[%d] = 1\n", y++); 12 | } 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /1174.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | double a[100]; 5 | int i; 6 | 7 | for (i=0; i<100; i++){ 8 | scanf("%lf", &a[i]); 9 | } 10 | for (i=0; i <100; i++){ 11 | if (a[i] <= 10){ 12 | printf("A[%d] = %.1lf\n", i, a[i]); 13 | } 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /1007.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int A, B, C, D, DIFERENCA; 5 | 6 | scanf("%d",&A); 7 | scanf("%d",&B); 8 | scanf("%d",&C); 9 | scanf("%d",&D); 10 | 11 | DIFERENCA = (A * B - C * D); 12 | 13 | printf("DIFERENCA = %d\n", DIFERENCA); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /1013.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int a, b, c, x; 6 | int maior, maior1; 7 | 8 | scanf("%d %d %d", &a, &b, &c); 9 | 10 | x = (a+b+abs(a-b))/2; 11 | maior = (x+c+abs(x-c))/2; 12 | 13 | printf("%d eh o maior\n", maior); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /1080.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int num,i, posi=0, aux=0; 5 | 6 | for (i=0; i<100; i++){ 7 | scanf("%d", &num); 8 | if (num>aux){ 9 | aux = num; 10 | posi = i+1; 11 | } 12 | } 13 | printf("%d\n", aux); 14 | printf("%d\n", posi); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /1096.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i; 6 | 7 | for (i = 1; i <= 9;i = i + 2) 8 | { 9 | printf("I=%d J=7\n", i); 10 | printf("I=%d J=6\n", i); 11 | printf("I=%d J=5\n", i); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /1002.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | double r; 7 | double pi= 3.14159; 8 | double area; 9 | 10 | cin >> r; 11 | area = pi*(r*r); 12 | 13 | cout.precision(4); 14 | cout << "A="< 2 | 3 | int main (){ 4 | double tempo, velocidade, distancia, litros; 5 | 6 | scanf("%lf", &tempo); 7 | scanf("%lf", &velocidade); 8 | 9 | distancia = tempo * velocidade; 10 | litros = distancia / 12; 11 | 12 | printf("%.3lf\n", litros); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /2006.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | int t, n[5], i; 7 | int cont=0; 8 | cin >> t; 9 | 10 | for (i=0; i<5; i++){ 11 | cin >> n[i]; 12 | if (n[i]==t) 13 | cont++; 14 | } 15 | cout < 2 | #include 3 | 4 | int main() { 5 | int num,i, num2, num3; 6 | 7 | scanf("%d", &num); 8 | 9 | for (i=1; i<=num; i++){ 10 | num2 = pow (i,2); 11 | num3 = pow (i,3); 12 | printf("%d %d %d\n",i, num2, num3); 13 | } 14 | 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /1589.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | int i, t, resultado; 5 | int num1, num2; 6 | 7 | scanf("%d", &t); 8 | 9 | for (i=0; i 2 | 3 | int main(){ 4 | int num; 5 | float hora, salario, total; 6 | 7 | scanf("%d", &num); 8 | scanf("%f", &hora); 9 | scanf("%f", &salario); 10 | 11 | total = (hora * salario); 12 | 13 | printf("NUMBER = %d\n", num); 14 | printf("SALARY = U$ %.2f\n",total); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /1441.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int main (){ 5 | int H, h_p, maior; 6 | 7 | while(cin>>H, H!=0 ){ 8 | maior =H; 9 | while(H!=1){ 10 | h_p = ( H % 2 == 0 ) ? 0.5 * H : 3 * H + 1; 11 | if ( h_p > maior ) maior = h_p; 12 | H = h_p; 13 | } 14 | cout< 2 | 3 | int main(){ 4 | int num,i; 5 | double num1, num2, num3, ponderada; 6 | 7 | scanf("%d", &num); 8 | 9 | for (i=0; i 2 | 3 | int main(){ 4 | char nome[10]; 5 | double TOTAL, vendas, salario, comissao; 6 | 7 | scanf("%s", nome); 8 | scanf("%lf", &salario); 9 | scanf("%lf", &vendas); 10 | 11 | comissao = vendas*0.15; 12 | TOTAL = (salario + comissao); 13 | 14 | printf("TOTAL = R$ %.2lf\n", TOTAL); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /1116.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int num,i; 5 | float num1, num2; 6 | 7 | scanf("%d", &num); 8 | 9 | for (i=0; i 2 | #include 3 | 4 | int main(){ 5 | int contador, i; 6 | double n[6]; 7 | 8 | contador =0; 9 | 10 | for (i =0 ; i<6; i++){ 11 | scanf("%lf", &n[i]); 12 | 13 | if ( n[i] >0){ 14 | contador = contador +1; 15 | } 16 | 17 | } 18 | printf("%d valores positivos\n", contador); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /1175.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | 5 | int a[20], i, aux; 6 | 7 | for (i=0; i<20; i++){ 8 | scanf("%d", &a[i]); 9 | 10 | } 11 | for (i =0; i<10; i++){ 12 | aux = a[i]; 13 | a[i]= a[19-i]; 14 | a[19-i]= aux; 15 | } 16 | 17 | for (i=0; i<20; i++){ 18 | printf("N[%d] = %d\n", i, a[i]); 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /1142.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int n, i,numero=1; 5 | 6 | scanf("%d", &n); 7 | 8 | for(i = 1; i <= n; i++) { 9 | for( ;numero <=4*n; numero++){ 10 | 11 | if((numero % 4) == 0){ 12 | printf("PUM\n"); 13 | }else{ 14 | printf("%d ", numero); 15 | } 16 | } 17 | } 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /1010.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int cod1, quant1, cod2, quant2; 5 | float valor1, valor2, total; 6 | 7 | scanf("%d %d %f", &cod1, &quant1, &valor1); 8 | scanf("%d %d %f", &cod2, &quant2, &valor2); 9 | 10 | total = ((quant1 * valor1)+(quant2 * valor2)); 11 | 12 | printf("VALOR A PAGAR: R$ %.2f\n", total); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /1035.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a, b, c, d, cd, ab; 5 | 6 | scanf("%d %d %d %d", &a, &b, &c, &d); 7 | 8 | cd = c + d; 9 | ab = a + b; 10 | 11 | if (b > c && d > a && cd > ab && c > 0 && d >0){ 12 | if(a % 2 == 0){ 13 | printf("Valores aceitos\n"); 14 | } 15 | } 16 | else{ 17 | printf("Valores nao aceitos\n"); 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /1161.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | long long int fat (int x){ 6 | if (x == 0){ 7 | return 1; 8 | }else { 9 | return x*fat(x-1); 10 | } 11 | } 12 | 13 | int main (){ 14 | int n, m; 15 | long long int soma; 16 | 17 | while (scanf("%d %d", &n, &m)!=EOF){ 18 | soma = fat(n) + fat(m); 19 | cout < 2 | using namespace std; 3 | 4 | int main() { 5 | string line; 6 | 7 | double ans = 0, t = 0, m; 8 | cout << setprecision(1) << fixed; 9 | 10 | while (getline(cin, line)) { 11 | getline(cin, line); 12 | stringstream ss(line); 13 | ss >> m; 14 | ans += m; 15 | t++; 16 | } 17 | cout << (ans / t) << endl; 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /1020.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (){ 5 | int num, ano, mes, dia; 6 | 7 | scanf("%d",&num); 8 | 9 | ano = floor(num / 365); 10 | mes = floor((num % 365)/30); 11 | dia = (num % 365) % 30; 12 | 13 | if (mes >=12){ 14 | ano = ano + floor(mes/12); 15 | mes %= 12; 16 | } 17 | printf("%d ano(s)\n%d mes(es)\n%d dia(s)\n", ano, mes, dia); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /1234.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | string line; 7 | while (getline(cin, line)) { 8 | int j = 0; 9 | for (auto &i: line) { 10 | if (isalpha(i)) { 11 | if (j & 1) 12 | i = tolower(i); 13 | else 14 | i = toupper(i); 15 | j ^= 1; 16 | } 17 | } 18 | cout << line << endl; 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /1015.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | double x1, y1, x2, x3, y3, y2, p1, p2, dist, dist1, powx, powy; 6 | 7 | scanf("%lf %lf", &x1, &y1); 8 | scanf("%lf %lf", &x2, &y2); 9 | 10 | x3 = x2 - x1; 11 | y3 = y2 - y1; 12 | 13 | powx = pow(x3,2); 14 | powy = pow(y3,2); 15 | 16 | dist = powx + powy; 17 | dist1 = pow(dist,0.5); 18 | 19 | printf("%.4lf\n", dist1); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /1661.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int i; 7 | int n; 8 | while (cin >> n && n) { 9 | vector a(n); 10 | 11 | for (i=0; i> a[i]; 13 | } 14 | long long acc = 0, ans = 0; 15 | for (i = 0; i < n; ++i) { 16 | acc += a[i]; 17 | ans += llabs(acc); //Valor absoluto 18 | } 19 | cout << ans << endl; 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /1115.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int x, y; 5 | 6 | while (x!=0 || y!=0){ 7 | x=1; 8 | y=1; 9 | scanf("%d", &x); 10 | scanf("%d", &y); 11 | 12 | if (x>0 && y>0){ 13 | printf("primeiro\n"); 14 | }else if (x<0 && y>0 ){ 15 | printf("segundo\n"); 16 | }else if (x<0 && y<0){ 17 | printf("terceiro\n"); 18 | }else if (x>0 && y<0){ 19 | printf("quarto\n"); 20 | } 21 | else if (x == 0 || y == 0){ 22 | return 0; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /1064.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | int contador, i; 6 | double n[6], soma, media; 7 | 8 | contador =0; 9 | soma = 0; 10 | 11 | for (i =0 ; i<6; i++){ 12 | scanf("%lf", &n[i]); 13 | 14 | if ( n[i] >0){ 15 | contador = contador +1; 16 | soma += n[i]; 17 | media = soma/contador; 18 | } 19 | 20 | } 21 | 22 | printf("%d valores positivos\n", contador); 23 | 24 | printf("%.1lf\n", media); 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /1180.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define n 1000 3 | int main(){ 4 | int x[n], i; 5 | int menor, indicemenor, num ; 6 | 7 | scanf("%d", &num); 8 | 9 | 10 | for(i=0; i 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | int t, i; 7 | int resultado, n1, n2; 8 | char letra; 9 | 10 | scanf("%d", &t); 11 | for(i=0; i> n1 >> letra >> n2; 13 | if (n1 == n2){ 14 | resultado = n1*n2; 15 | }else if (letra >=65 && letra <= 90){ 16 | resultado = n2 -n1; 17 | }else if (letra >= 97 && letra<=122){ 18 | resultado = n1 + n2; 19 | } 20 | cout << resultado < 2 | /* 3 | int main(){ 4 | int num, i; 5 | 6 | scanf("%d", &num); 7 | 8 | for (i = num; i>=1; i--){ 9 | if (i % 2== 1){ 10 | printf("%d\n", i); 11 | } 12 | } 13 | */ 14 | 15 | int main () { 16 | 17 | int x, i; 18 | i = 0; 19 | scanf("%d", &x); 20 | 21 | while ( i< x) { 22 | i++; 23 | if (i%2 == 1) { 24 | printf("%d\n", i); 25 | 26 | } 27 | } 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /1117.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | double media, num1, num2; 5 | 6 | do{ 7 | scanf("%lf", &num1); 8 | if (num1<0 || num1 >10){ 9 | printf("nota invalida\n"); 10 | } 11 | }while(num1<0 || num1>10); 12 | 13 | do{ 14 | scanf("%lf", &num2); 15 | if (num2 <0 || num2 > 10){ 16 | printf("nota invalida\n"); 17 | } 18 | }while(num2<0 || num2>10); 19 | 20 | media = (num1 + num2)/2; 21 | printf("media = %.2f\n", media); 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /1030.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int josephus(int n, int k) { 6 | int x = 0, i; 7 | for (i = 2; i <= n; ++i) { 8 | x = (x + k) % i; 9 | } 10 | return x; 11 | } 12 | 13 | int main() { 14 | int t, i; 15 | int n, k; // n pessoas k pulos 16 | 17 | cin >> t; 18 | 19 | for (i = 0; i < t; ++i) { 20 | cin >> n >> k; 21 | cout << "Case " << i + 1 << ": "; 22 | cout << josephus(n, k) + 1 << endl; 23 | } 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /1134.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | int num, alcool=0, gasolina=0, diesel=0; 5 | //scanf("%d",& num); 6 | while (num != 4){ 7 | scanf("%d",& num); 8 | if (num ==1){ 9 | alcool= alcool +1; 10 | }else if (num == 2 ){ 11 | gasolina = gasolina +1; 12 | }else if (num ==3){ 13 | diesel = diesel +1; 14 | } 15 | } 16 | printf("MUITO OBRIGADO\n"); 17 | printf("Alcool: %d\n", alcool); 18 | printf("Gasolina: %d\n", gasolina); 19 | printf("Diesel: %d\n", diesel); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /1245.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | 6 | int n; 7 | while (cin >> n) { 8 | vector d(100), e(100); 9 | int size; char t; 10 | for (int i = 0; i < n; ++i) { 11 | cin >> size >> t; 12 | if (t == 'D') 13 | d[size]++; 14 | else 15 | e[size]++; 16 | } 17 | 18 | int ans = 0; 19 | for (int i = 0; i < 100; ++i) 20 | ans += min(d[i], e[i]); 21 | cout << ans << endl; 22 | } 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /1037.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | float a, b, x; 7 | 8 | cin >> a; 9 | 10 | if ( a >= 0 && a <= 25){ 11 | cout << "Intervalo [0,25]" << endl; 12 | }else if (a > 25 && a <= 50){ 13 | cout << "Intervalo (25,50]" << endl; 14 | }else if (a > 50 && a <=75){ 15 | cout << "Intervalo (50,75]"<< endl; 16 | }else if(a > 75 && a <=100){ 17 | cout << "Intervalo (75,100]"<< endl; 18 | }else { 19 | cout << "Fora de intervalo" << endl; 20 | } 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /1042.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | 5 | int i, j, num[3], aux, num2[3]; 6 | 7 | for(i=0; i<3; i++){ 8 | scanf("%d", &num[i]); 9 | num2[i] =num[i]; 10 | } 11 | 12 | for(i=0; i<3; i++){ 13 | for(j=i+1; j<3; j++){ 14 | if(num[i]>num[j]){ 15 | aux = num[i]; 16 | num[i]=num[j]; 17 | num[j]= aux; 18 | } 19 | } 20 | } 21 | for(i=0; i<3; i++){ 22 | printf("%d\n", num[i]); 23 | } 24 | printf("\n"); 25 | for(i=0; i<3; i++){ 26 | printf("%d\n", num2[i]); 27 | } 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /1036.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | double a, b, c, r1, r2, x; 7 | 8 | scanf("%lf", &a); 9 | scanf("%lf", &b); 10 | scanf("%lf", &c); 11 | 12 | x = b*b - 4*a*c; 13 | if(x > 0 && a != 0){ 14 | x = pow(x,0.5); 15 | 16 | r1 = (-b+x)/(2*a); 17 | r2 = (-b-x)/(2*a); 18 | 19 | printf("R1 = %.5lf\n", r1); 20 | printf("R2 = %.5lf\n", r2); 21 | } 22 | else{ 23 | printf("Impossivel calcular\n"); 24 | } 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /2235.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | 7 | int a, b, c; 8 | int somaac, somaab, somabc; 9 | 10 | cin >> a; 11 | cin >> b; 12 | cin >> c; 13 | 14 | somaac = a + c; 15 | somaab = a + b; 16 | somabc = b + c; 17 | 18 | if (a == c || a==b || b==c){ 19 | cout << "S" << endl; 20 | } 21 | else if (somaac == b || somabc ==a || somaab == c){ 22 | cout << "S" << endl; 23 | } 24 | else{ 25 | cout << "N" << endl; 26 | } 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /1332.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int cmp(string a, string b) { 6 | int match = 0, i; 7 | for (i = 0; i < a.size(); ++i) 8 | match += a[i] == b[i]; 9 | return match >= (a.size() - 1); 10 | } 11 | 12 | int main() { 13 | int n; 14 | string line; 15 | cin >> n; 16 | while (n--) { 17 | cin >> line; 18 | 19 | if (line.size() == 5) 20 | cout << 3 << endl; 21 | else 22 | if (cmp("one", line)) 23 | cout << 1 << endl; 24 | else 25 | cout << 2 << endl; 26 | } 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /1234.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (){ 5 | char vet[1000]; 6 | int i, a=0; 7 | 8 | while(gets(vet) != NULL){ 9 | a=0; 10 | for(i=0; vet[i] != '\0'; i++){ 11 | if(vet[i] >= 'A' && vet[i] <= 'Z'){ 12 | a++; 13 | if(a%2==0) 14 | vet[i]+=32; 15 | } 16 | if(vet[i] >= 'a' && vet[i] <= 'z'){ 17 | a++; 18 | if(a%2!=0) 19 | vet[i]-=32; 20 | } 21 | } 22 | printf("%s\n", vet); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /1091.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main( ) { 4 | int i, t, n, m, x, y; 5 | while ( scanf ( "%d", &t ) != EOF ) { 6 | if ( t == 0 ) return 0; 7 | scanf ( "%d %d", &n, &m ); 8 | while ( t-- ) { 9 | scanf ( "%d %d", &x, &y ); 10 | if ( x == n || y == m ) puts ( "divisa" ); 11 | else if ( x > n && y > m ) puts ( "NE" ); 12 | else if ( x > n && y < m ) puts ( "SE" ); 13 | else if ( x < n && y > m ) puts ( "NO" ); 14 | else if ( x < n && y < m ) puts ( "SO" ); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /1985.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | int t, i; 7 | double cod, mult, valor, total=0; 8 | 9 | cin >>t; 10 | 11 | for (i=0; i> cod; 13 | cin >> mult; 14 | 15 | if (cod == 1001){ 16 | valor = 1.5 * mult; 17 | }if (cod == 1002){ 18 | valor = 2.5* mult; 19 | }if (cod == 1003){ 20 | valor = 3.5* mult; 21 | }if (cod == 1004){ 22 | valor = 4.5* mult; 23 | }if (cod == 1005){ 24 | valor = 5.5* mult; 25 | } 26 | total +=valor; 27 | } 28 | cout.precision(2); 29 | cout < 2 | 3 | int main (){ 4 | int n, i, a[1001]; 5 | int dois=0, tres=0, quatro = 0, cinco =0; 6 | 7 | scanf("%d", &n); 8 | 9 | for (i=0; i 3 | using namespace std; 4 | 5 | int main(){ 6 | int n,m=0; 7 | string a; 8 | while(cin >> a){ 9 | for(int i = 0 ; i < a.size() ; i++) { 10 | for(int j = 0 ; j < a.size() ; j++) { 11 | if(j < i) 12 | cout << " "; 13 | else 14 | if(j == a.size() - 1) 15 | cout << a[j-i]; 16 | else 17 | cout << a[j-i] << " "; 18 | } 19 | cout << endl; 20 | } 21 | cout << endl; 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /1581.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int N; 7 | 8 | cin >> N; 9 | 10 | while (N--) { 11 | int K; 12 | string idioma_final; 13 | 14 | cin >> K; 15 | cin.ignore(1);//LImpeza de buffer 16 | 17 | getline(cin, idioma_final); 18 | 19 | for (int i = 1; i < K; i++) { 20 | string idioma; 21 | 22 | getline(cin, idioma); 23 | 24 | if (idioma != idioma_final) idioma_final = "ingles"; 25 | } 26 | 27 | cout << idioma_final << endl; 28 | } 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /1038.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int cod, quant; 5 | double total; 6 | 7 | scanf("%d %d", &cod, &quant); 8 | 9 | if (cod == 1){ 10 | total = quant * 4; 11 | printf("Total: R$ %.2lf\n", total); 12 | } 13 | if (cod == 2){ 14 | total = quant * 4.5; 15 | printf("Total: R$ %.2lf\n", total); 16 | } 17 | if (cod == 3){ 18 | total = quant * 5; 19 | printf("Total: R$ %.2lf\n", total); 20 | } 21 | if (cod == 4){ 22 | total = quant * 2; 23 | printf("Total: R$ %.2lf\n", total); 24 | } 25 | if (cod == 5){ 26 | total = quant * 1.5; 27 | printf("Total: R$ %.2lf\n", total); 28 | } 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /1074.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (){ 5 | int n, i, numero; 6 | i=0; 7 | 8 | scanf ("%d", &n); 9 | 10 | for (n=n; n>i; i++){ 11 | scanf("%d", &numero); 12 | 13 | if (numero % 2 == 0 && numero > 0){ 14 | printf("EVEN POSITIVE\n"); 15 | 16 | }else if (numero % 2 == 0 && numero < 0){ 17 | printf("EVEN NEGATIVE\n"); 18 | 19 | }else if (numero % 2 != 0 && numero > 0){ 20 | printf("ODD POSITIVE\n"); 21 | 22 | }else if (numero % 2 != 0 && numero < 0){ 23 | printf("ODD NEGATIVE\n"); 24 | 25 | }else if (numero == 0){ 26 | printf("NULL\n"); 27 | } 28 | } 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /1768.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | int n, i, j, k, t; 6 | 7 | while(scanf("%d", &n) !=EOF){ 8 | i = 1; 9 | t = n/2; 10 | 11 | while(i <= n){ 12 | for (j = 0; j < t; ++j) 13 | printf(" "); 14 | for (j = 0; j < i; ++j) 15 | printf("*"); 16 | 17 | i += 2; 18 | t--; 19 | printf("\n"); 20 | } 21 | 22 | i = 1; 23 | t = n/2; 24 | 25 | while(i <= 3){ 26 | for (j = 0; j < t; ++j) 27 | printf(" "); 28 | for (j = 0; j < i; ++j) 29 | printf("*"); 30 | 31 | i += 2; 32 | t--; 33 | printf("\n"); 34 | } 35 | 36 | printf("\n"); 37 | } 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /1012.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | double a, b, c, at, ac, atra, aq, ar, pi; 6 | 7 | scanf("%lf", &a); 8 | scanf("%lf", &b); 9 | scanf("%lf", &c); 10 | //Area Triangulo 11 | at = (a * c)/2; 12 | //Area Circulo 13 | pi = 3.14159; 14 | ac = (pi * pow(c,2)); 15 | //Area Trapezio 16 | atra = ((a+b)*c)/2; 17 | //Area Quadrado 18 | aq = pow(b,2); 19 | //Area Retangulo 20 | ar = a * b; 21 | //total 22 | printf("TRIANGULO: %.3lf\n", at); 23 | printf("CIRCULO: %.3lf\n", ac); 24 | printf("TRAPEZIO: %.3lf\n", atra); 25 | printf("QUADRADO: %.3lf\n", aq); 26 | printf("RETANGULO: %.3lf\n", ar); 27 | 28 | return 0; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /1061.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | string t; 8 | long long d, h , m, s, 9 | dd, hh, mm, ss; 10 | 11 | cin >> t >> d >> h >> t >> m >> t >> s; 12 | cin >> t >> dd >> hh >> t >> mm >> t >> ss; 13 | 14 | long long ans = (dd - d) * 3600 * 24 + (hh - h) * 3600 + (mm - m) * 60 + (ss - s); 15 | 16 | cout << ans / (3600 * 24) << " dia(s)" << endl; 17 | ans %= 3600 * 24; 18 | cout << ans / 3600 << " hora(s)" << endl; 19 | ans %= 3600; 20 | cout << ans / 60 << " minuto(s)" << endl; 21 | ans %= 60; 22 | cout << ans << " segundo(s)" << endl; 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /1068.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | char linha[1001]; 7 | int i,esq, dir; 8 | while(scanf("%s",linha) != EOF){ 9 | esq = 0; 10 | dir = 0; 11 | for(i = 0; linha[i] != '\0'; i++){ 12 | if(linha[i] == '(') esq++; 13 | else if (linha[i] == ')'){ 14 | dir++; 15 | if(esq > 0){ 16 | esq--; 17 | dir--; 18 | } 19 | } 20 | } 21 | if(esq == 0 && dir == 0) 22 | printf("correct\n"); 23 | else printf("incorrect\n"); 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /1140.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int size; 7 | string s; 8 | char c; 9 | bool b, check; 10 | 11 | while(getline(cin, s)) 12 | { 13 | if(s == "*") 14 | break; 15 | 16 | transform (s.begin(), s.end(), s.begin(), ::tolower); 17 | size = s.size(); 18 | c = s[0]; 19 | b = false; 20 | check = true; 21 | 22 | for (int i = 0; i < size; ++i) 23 | { 24 | if(s[i] != ' ' && b == false){ 25 | if(s[i] != c){ 26 | check = false; 27 | } 28 | 29 | b = true; 30 | }else{ 31 | if(s[i] == ' ') 32 | b = false; 33 | } 34 | } 35 | 36 | if(check){ 37 | puts("Y"); 38 | }else{ 39 | puts("N"); 40 | } 41 | } 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /1050.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int DDD; 5 | 6 | scanf ("%d", &DDD); 7 | 8 | if (DDD == 61){ 9 | printf("Brasilia\n"); 10 | } 11 | else if (DDD == 71){ 12 | printf("Salvador\n"); 13 | } 14 | else if (DDD == 11){ 15 | printf("Sao Paulo\n"); 16 | } 17 | else if (DDD == 21){ 18 | printf("Rio de Janeiro\n"); 19 | } 20 | else if (DDD == 32){ 21 | printf("Juiz de Fora\n"); 22 | } 23 | else if (DDD == 19){ 24 | printf("Campinas\n"); 25 | } 26 | else if (DDD == 27){ 27 | printf("Vitoria\n"); 28 | } 29 | else if (DDD == 31){ 30 | printf("Belo Horizonte\n"); 31 | } 32 | else{ 33 | printf("DDD nao cadastrado\n"); 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /1069.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | char linha[1001]; 7 | int i,esq, dir, diamantes=0, cases; 8 | scanf("%d", &cases); 9 | while(cases--){ 10 | diamantes =0; 11 | scanf("%s",linha); 12 | esq = 0; 13 | dir = 0; 14 | 15 | for(i = 0; linha[i] != '\0'; i++){ 16 | if(linha[i] == '<') esq++; 17 | else if (linha[i] == '>'){ 18 | dir++; 19 | if(esq > 0){ 20 | esq--; 21 | dir--; 22 | diamantes++; 23 | } 24 | } 25 | } 26 | printf("%d\n", diamantes); 27 | } 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /1051.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (){ 5 | double salario, salarioconta, salariototal, salariototal1, salariototal2, salariototal3; 6 | 7 | scanf("%lf", &salario); 8 | 9 | if ( salario <= 2000){ 10 | printf("Isento\n"); 11 | 12 | }else if (salario > 2000 && salario <= 3000){ 13 | salarioconta = (salario - 2000); 14 | salariototal = (salarioconta*0.08); 15 | printf("R$ %.2lf\n", salariototal); 16 | 17 | }else if ( salario > 3000 && salario <= 4500){ 18 | salariototal2 = (((salario-3000)*0.18)+ 80); 19 | printf("R$ %.2lf\n", salariototal2); 20 | 21 | }else if (salario > 4500){ 22 | salariototal3 = (((salario-4500)*0.28)+ 350); 23 | printf("R$ %.2lf\n", salariototal3); 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /1104.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int alice[100001]; 6 | int beatriz[100001]; 7 | 8 | int main(){ 9 | int a, b, x, i, c, al, be; 10 | 11 | while(scanf("%d %d", &a, &b), a != 0 && b !=0){ 12 | 13 | memset(alice, 0, sizeof(alice)); 14 | memset(beatriz, 0, sizeof(beatriz)); 15 | c = 0, al = 0, be = 0; 16 | 17 | for (i = 0; i < a; ++i){ 18 | scanf("%d", &x); 19 | alice[x]++; 20 | } 21 | 22 | for (i = 0; i < b; ++i){ 23 | scanf("%d", &x); 24 | beatriz[x]++; 25 | } 26 | 27 | for (i = 0; i < 100001; ++i){ 28 | if(alice[i] != 0 && beatriz[i] == 0) 29 | al++; 30 | if(alice[i] == 0 && beatriz[i] != 0) 31 | be++; 32 | } 33 | 34 | if(al < be) 35 | printf("%d\n", al); 36 | else 37 | printf("%d\n", be); 38 | } 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /1052.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | int a; 5 | scanf ("%d", &a); 6 | 7 | if(a==1){ 8 | printf ("January\n"); 9 | } 10 | if(a==2){ 11 | printf("February\n"); 12 | } 13 | if(a==3){ 14 | printf("March\n"); 15 | } 16 | if(a==4){ 17 | printf("April\n"); 18 | } 19 | if(a==5){ 20 | printf("May\n"); 21 | } 22 | if(a==6){ 23 | printf("June\n"); 24 | } 25 | if(a==7){ 26 | printf("July\n"); 27 | } 28 | if (a==8){ 29 | printf("August\n"); 30 | } 31 | if(a==9){ 32 | printf("September\n"); 33 | } 34 | if (a==10){ 35 | printf("October\n"); 36 | } 37 | if (a==11){ 38 | printf("November\n"); 39 | } 40 | if (a==12){ 41 | printf("December\n"); 42 | } 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /1221.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | int n, cont; 6 | long long p; 7 | 8 | cin >> n; 9 | 10 | for(int i = 0; i > p; 13 | 14 | if(p == 0 || p ==1){ 15 | printf("Not Prime\n"); 16 | continue; 17 | } 18 | 19 | if(p == 2){ 20 | printf("Prime\n"); 21 | continue; 22 | } 23 | 24 | for(int i = 2; i < sqrt(p)+1; i++){ 25 | if(p % i == 0) cont++; 26 | if(cont == 2) break; 27 | } 28 | 29 | if(cont >= 1) printf("Not Prime\n"); 30 | else printf("Prime\n"); 31 | } 32 | return 0; 33 | } -------------------------------------------------------------------------------- /1018.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | int N, cem, cinquenta, cinquenta1, vinte, vinte1, dez, dez1, cinco, cinco1, dois, dois1, um, um1; 7 | 8 | scanf("%d", &N); 9 | printf("%d\n", N); 10 | cem = N/100; 11 | cinquenta = N%100; 12 | cinquenta1 = cinquenta/50; 13 | vinte = cinquenta%50; 14 | vinte1 = vinte/20; 15 | dez = vinte%20; 16 | dez1 = dez/10; 17 | cinco = dez%10; 18 | cinco1 = cinco/5; 19 | dois = cinco%5; 20 | dois1 = dois/2; 21 | um = dois%2; 22 | um1 = um/1; 23 | 24 | printf("%d nota(s) de R$ 100,00\n",cem); 25 | printf("%d nota(s) de R$ 50,00\n",cinquenta1); 26 | printf("%d nota(s) de R$ 20,00\n",vinte1); 27 | printf("%d nota(s) de R$ 10,00\n",dez1); 28 | printf("%d nota(s) de R$ 5,00\n",cinco1); 29 | printf("%d nota(s) de R$ 2,00\n",dois1); 30 | printf("%d nota(s) de R$ 1,00\n",um1); 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /1654_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | int a, b, c, d; 7 | double pot = pow (10,6); 8 | double a1, b1, c1, d1; 9 | 10 | for (a=1; a<=211; a++){ 11 | for (b=a; ((a+b+b+b) <= 2000) && ((a*b*b*b) <= (20*pow(10,8))); b++){//Multiplica 10^2 12 | for (c=b; ((a+b+c+c) <= 2000) && ((a*b*c*c) <= (20*pow(10,8))); c++){//Multiplica 10^2 13 | 14 | d = ((pot *(a+b+c))/(a*b*c - pot)); 15 | 16 | if (((a+b+c+d) == ((a*b*c*d)/(pow(10,6))))){ // (a+b+c+d)/100 == (a*b*c*d)/10^8 17 | if ((a+b+c+d)<=2000 && (d>=c) && ((a*b*c*d)<=(20*pow(10,8)))){ 18 | a1 = a/100.00; 19 | b1 = b/100.00; 20 | c1 = c/100.00; 21 | d1 = d/100.00; 22 | printf("%.2lf %.2lf %.2lf %.2lf\n", a1, b1, c1, d1); 23 | 24 | } 25 | } 26 | } 27 | } 28 | } 29 | 30 | return 0; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /1211.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int i, j, sz; 6 | 7 | bool compare(string a, string b){ 8 | sz = a.length(); 9 | 10 | for (i = 0; i < sz; ++i) 11 | { 12 | if(a[i] < b[i]) return 1; 13 | if(a[i] > b[i]) return 0; 14 | } 15 | 16 | return 1; 17 | } 18 | 19 | int main(){ 20 | int n, l, c; 21 | char s[205]; 22 | string base; 23 | 24 | while(scanf("%d", &n) == 1){ 25 | vector v; 26 | c = 0; 27 | 28 | for (i = 0; i < n; ++i) 29 | { 30 | scanf("%s", s); 31 | v.push_back(s); 32 | } 33 | 34 | sort(v.begin(), v.end(), compare); 35 | base = v[0]; 36 | l = base.length(); 37 | 38 | for (i = 1; i < n; ++i) 39 | { 40 | for (j = 0; j < l; ++j) 41 | { 42 | if(base[j] == v[i][j]) c++; 43 | else 44 | break; 45 | } 46 | base = v[i]; 47 | } 48 | 49 | printf("%d\n", c); 50 | } 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /1183.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define tam 12 3 | int main (){ 4 | int i, j; 5 | double soma=0, media=0, a[tam][tam]; 6 | char op; 7 | 8 | fflush(stdin); 9 | scanf("%c", &op); 10 | 11 | for (i=0; i 2 | #define tam 12 3 | int main (){ 4 | int i, j; 5 | double soma=0, media=0, a[tam][tam]; 6 | char op; 7 | 8 | fflush(stdin); 9 | scanf("%c", &op); 10 | 11 | for (i=0; ij){ 33 | soma += a[i][j]; 34 | } 35 | } 36 | } 37 | printf("%.1lf\n", soma); 38 | }else if (op == 'M'){ 39 | for (i=0; ij){ 42 | soma += a[i][j]; 43 | media = (soma/(((tam*tam)-tam)/2)); 44 | } 45 | } 46 | } 47 | printf("%.1lf\n", media); 48 | } 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /SQL/README.md: -------------------------------------------------------------------------------- 1 | # 👨🏻‍💻 [URI - Online Judge (Problems & Contests)] 2 | > 📌 Algumas soluções para problemas do URI Online Judge. As soluções foram desenvolvidas 3 | em Structured Query Language, ou Linguagem de Consulta Estruturada ou SQL. 4 | 5 | O URI Online Judge é um projeto que está sendo desenvolvido pela Computer Science 6 | Departamento da URI University. O objetivo principal do projeto é fornecer programação 7 | prática e compartilhamento de conhecimento. O URI Online Judge contém mais de 1.000 problemas 8 | dividido em 8 grandes categorias. Esta divisão ajuda os usuários a se concentrar em 9 | tópicos de programação. Todos os problemas estão disponíveis em português e inglês. 10 | 11 | Os problemas podem ser resolvidos utilizando C, C++, C#, Java, Go, Ruby, Scala ou Python, competindo com os outros usuários. 12 | Como desafio, você pode melhorar seu ranking, resolver o máximo de problemas e aperfeiçoar seu código fonte. 13 | 14 | [URI - Online Judge (Problems & Contests)]: https://www.urionlinejudge.com.br/ 15 | -------------------------------------------------------------------------------- /1168.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main (){ 6 | int t, i; 7 | string num; 8 | int numled=0; 9 | 10 | cin >> t; 11 | getline(cin, num); 12 | for (i=0; i 2 | 3 | int main (){ 4 | 5 | int p, j1, j2, r,a; 6 | int soma, parimpar; 7 | 8 | scanf("%d", &p); 9 | scanf("%d", &j1); 10 | scanf("%d", &j2); 11 | scanf("%d", &r); 12 | scanf("%d", &a); 13 | 14 | soma = j1 +j2; 15 | 16 | if (soma %2 == 0){ 17 | parimpar = 0; // par 18 | }else{ 19 | parimpar = 1; // impar 20 | } 21 | 22 | // Ganhador 1 23 | if (p == 1 && parimpar == 0 && r ==0 && a==0){// p == 1 par jogador 1 24 | printf("Jogador 1 ganha!\n"); 25 | }else if (p == 0 && parimpar == 1 && r ==0 && a ==0 ){ // p ==0 impar jogador 1 26 | printf("Jogador 1 ganha!\n"); 27 | }else if (r ==1 && a ==0){// Jogador 1 roubou 28 | printf("Jogador 1 ganha!\n"); 29 | }else if (r == 1 && a == 1){//Acusou o roubo 30 | printf("Jogador 2 ganha!\n"); 31 | }else if (p==1 && parimpar == 1 && r ==0 && a==0){ 32 | printf("Jogador 2 ganha!\n"); 33 | }else if (p==0 && parimpar ==0 && r ==0 && a==0){ 34 | printf("Jogador 2 ganha!\n"); 35 | }else if (r ==0 && a ==1){ 36 | printf("Jogador 1 ganha!\n"); 37 | } 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /1222_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int N, L, C; 7 | 8 | while (cin >> N >> L >> C) { 9 | string linha, word; 10 | 11 | cin.ignore(1); 12 | 13 | getline(cin, linha); 14 | 15 | stringstream ss(linha); 16 | 17 | int colunas = 0, 18 | linhas = 0, 19 | paginas = 0; 20 | 21 | while (ss >> word) { 22 | if (colunas + word.length() == C) { 23 | colunas = 0; 24 | linhas++; 25 | } 26 | else if (colunas + word.length() > C) { 27 | colunas = word.length() + 1; 28 | linhas++; 29 | } 30 | else { 31 | colunas += word.length() + 1; 32 | } 33 | 34 | if (linhas == L) { 35 | paginas++; 36 | linhas = 0; 37 | } 38 | } 39 | 40 | if (linhas > 0 || colunas > 0) paginas++; 41 | 42 | cout << paginas << '\n'; 43 | } 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /1245.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | typedef struct tipoCalcados { 4 | int direito, esquerdo; 5 | } tipoCalcados; 6 | 7 | int main ( ) { 8 | tipoCalcados calcados[111]; 9 | int N, i, j, total, numero, maior, menor; 10 | char tam; 11 | while ( scanf ( "%d", &N ) != EOF ) { 12 | total = maior = 0, menor = 1111; 13 | for ( i=29; i<62; i++ ) calcados[i].esquerdo = calcados[i].direito = 0; 14 | for ( i=0; i maior ) maior=numero; 17 | if ( numero < menor ) menor=numero; 18 | if ( tam == 'E' ) calcados[numero].esquerdo++; 19 | else calcados[numero].direito++; 20 | } 21 | for ( i=menor; i<=maior; i++ ) { 22 | if ( calcados[i].esquerdo > 0 && calcados[i].direito > 0) { 23 | if ( calcados[i].esquerdo >= calcados[i].direito ) total = total+calcados[i].direito; 24 | else total = total+calcados[i].esquerdo; 25 | } 26 | } 27 | printf ( "%d\n", total ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /2334.java: -------------------------------------------------------------------------------- 1 | import java.io.IOException; 2 | import java.math.BigInteger; 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | 7 | public static void main(String[] args) throws IOException { 8 | 9 | BigInteger num, resultado; 10 | BigInteger sub = new BigInteger("1"); 11 | BigInteger zero = new BigInteger("0"); 12 | BigInteger menosum = new BigInteger("-1"); 13 | int compare; 14 | boolean teste; 15 | Scanner scan = new Scanner(System.in); 16 | 17 | do{ 18 | num = scan.nextBigInteger(); 19 | compare = num.compareTo(zero); 20 | teste = num.equals(menosum); 21 | if (compare == 0){ 22 | System.out.printf("%d\n", zero); 23 | continue; 24 | }if (teste != true){ 25 | resultado = num.subtract(sub); 26 | System.out.printf("%d\n", resultado ); 27 | continue; 28 | } 29 | }while (teste == false); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /1049.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | char carac1[30], carac2[30], carac3[30]; 6 | 7 | gets(carac1); 8 | gets(carac2); 9 | gets(carac3); 10 | 11 | if (strcmp(carac1,"vertebrado")==0){ 12 | if (strcmp(carac2,"ave")==0){ 13 | if (strcmp(carac3,"carnivoro")==0){ 14 | printf("aguia\n"); 15 | } 16 | if (strcmp(carac3,"onivoro")==0){ 17 | printf("pomba\n"); 18 | } 19 | } 20 | if (strcmp(carac2,"mamifero")==0){ 21 | if (strcmp(carac3,"onivoro")==0){ 22 | printf("homem\n"); 23 | } 24 | if (strcmp(carac3,"herbivoro")==0){ 25 | printf("vaca\n"); 26 | } 27 | } 28 | } 29 | if (strcmp(carac1,"invertebrado")==0){ 30 | if (strcmp(carac2,"inseto")==0){ 31 | if (strcmp(carac3,"hematofago")==0){ 32 | printf("pulga\n"); 33 | } 34 | if (strcmp(carac3,"herbivoro")==0){ 35 | printf("lagarta\n"); 36 | } 37 | } 38 | if (strcmp(carac2,"anelideo")==0){ 39 | if (strcmp(carac3,"hematofago")==0){ 40 | printf("sanguessuga\n"); 41 | } 42 | if (strcmp(carac3,"onivoro")==0){ 43 | printf("minhoca\n"); 44 | } 45 | } 46 | } 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /1222.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int main(){ 5 | int numPalavras, linhas, paginas, caracs, i; 6 | short maxLinhas, maxCarac; 7 | char palavra[71]; 8 | 9 | while(scanf("%d %hd %d", &numPalavras, &maxLinhas, &maxCarac) != EOF){ 10 | for(i = 1, linhas = paginas = caracs = 0; i <= numPalavras; i++){ 11 | scanf("%s", &palavra); 12 | 13 | caracs += strlen(palavra); 14 | 15 | if(caracs == maxCarac){ 16 | caracs = 0; 17 | linhas++; 18 | } 19 | else if(caracs > maxCarac){ 20 | caracs = strlen(palavra) + 1; 21 | linhas++; 22 | } 23 | 24 | else if(i < numPalavras){ 25 | caracs++; 26 | 27 | if(caracs == maxCarac){ 28 | caracs = 0; 29 | linhas++; 30 | } 31 | } 32 | 33 | if(linhas == maxLinhas){ 34 | linhas = 0; 35 | paginas++; 36 | } 37 | } 38 | 39 | if(linhas > 0 || caracs > 0) paginas++; 40 | printf("%d\n", paginas); 41 | } 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /1103.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (){ 5 | int h1, m1, h2, m2; 6 | int hf, mf, res; 7 | 8 | 9 | while (scanf("%d %d %d %d", &h1, &m1, &h2, &m2),(h1 != 0) || (m1 !=0) || (h2 !=0) || (m2!=0)){ 10 | if ( m2>m1 && h1==h2 ){ 11 | res = m2-m1; 12 | }else{ 13 | if ( m1>m2 && h1==h2 ){ 14 | res = 1440-(m1-m2); 15 | }else{ 16 | if ( h1>h2 ){ 17 | res = (h1-h2)*60; 18 | res = 1440-res; 19 | if ( m1>m2 ){ 20 | res = res-(m1-m2); 21 | }else{ 22 | res = res + (m2-m1); 23 | } 24 | }else{ 25 | res = (h2-h1)*60; 26 | if ( m1>m2 ){ 27 | res = res - (m1-m2); 28 | }else{ 29 | res = res + (m2-m1); 30 | } 31 | } 32 | } 33 | } 34 | printf ("%d\n", res); 35 | 36 | 37 | } 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /1396.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n, k, c = 1; 7 | int i; 8 | 9 | while(cin >> n >> k && n > 0) { 10 | vector nomes(n); 11 | map ordem; 12 | 13 | for(i = 0; i < n; ++i) { 14 | cin >> nomes[i]; 15 | ordem[nomes[i]] = i; 16 | } 17 | 18 | int flag = 0; 19 | 20 | while(!ordem.empty() && k > 0) {//ENQUANTO DIFERENTE DE VAZIO 21 | for(map::iterator it = ordem.begin(); it != ordem.end() && k > 0; ++it){ 22 | if (it->second - flag <= k) { 23 | k -= (it->second - flag); 24 | 25 | for(i = it->second; i > flag; --i) { 26 | nomes[i] = nomes[i - 1]; 27 | ++ordem[nomes[i - 1]]; 28 | } 29 | 30 | nomes[flag] = it->first; 31 | ++flag; 32 | ordem.erase(it->first); 33 | break; 34 | } 35 | } 36 | } 37 | 38 | cout << "Instancia " << c++ << '\n'; 39 | for(i = 0; i < n; ++i) 40 | cout << nomes[i] << ' '; 41 | cout << "\n\n"; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /2031.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | int t, i; 5 | char n1[10], n2[10]; 6 | 7 | scanf("%d", &t); 8 | 9 | for (i=0; i 2 | #define MAX 200000 3 | using namespace std; 4 | typedef long long ll; 5 | typedef pair ii; 6 | typedef vector vi; 7 | typedef vector< ii > vii; 8 | vii g[MAX + 1]; 9 | bool visitado[MAX+1]; 10 | int n,m; 11 | 12 | ll prim(int s){ 13 | ll cost = 0; 14 | priority_queue< ii, vector, greater > pq; 15 | for(int i = 0; i <=n ;i++) visitado[i] = false; 16 | for(int i = 0; i< g[s].size(); i++){ 17 | pq.push(ii(g[s][i].second,g[s][i].first)); 18 | visitado[s] = true; 19 | } 20 | while(!pq.empty()){ 21 | ii aux = pq.top(); 22 | pq.pop(); 23 | int u,d; 24 | u = aux.first; 25 | d = aux.second; 26 | if(!visitado[d]){ 27 | cost += u; 28 | visitado[d] = true; 29 | for(int i = 0;i < g[d].size(); i++){ 30 | if(!visitado[g[d][i].first]) 31 | pq.push(ii(g[d][i].second,g[d][i].first)); 32 | } 33 | } 34 | } 35 | return cost; 36 | } 37 | 38 | int main(){ 39 | cin >> m >> n; 40 | 41 | while(n!=0 || m!=0){ 42 | for(int i = 0;i <=m ;i++) g[i].clear(); 43 | ll total = 0; 44 | for(int i = 0; i> x >> y >> z; 47 | g[x].push_back(ii(y,z)); 48 | g[y].push_back(ii(x,z)); 49 | total += z; 50 | } 51 | ll resp = total - prim(0); 52 | cout << resp << endl; 53 | cin >> m >> n; 54 | } 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /1048.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (){ 4 | double salario, reajuste, salariototal; 5 | 6 | scanf("%lf", &salario); 7 | 8 | if (salario > 0 && salario <= 400){ 9 | reajuste = salario * 0.15; 10 | salariototal = salario + reajuste; 11 | printf("Novo salario: %.2lf\n", salariototal); 12 | printf("Reajuste ganho: %.2lf\n", reajuste); 13 | printf("Em percentual: 15 %%\n"); 14 | }else if (salario >=400.01 && salario <=800){ 15 | reajuste = salario * 0.12; 16 | salariototal = salario + reajuste; 17 | printf("Novo salario: %.2lf\n", salariototal); 18 | printf("Reajuste ganho: %.2lf\n", reajuste); 19 | printf("Em percentual: 12 %%\n"); 20 | }else if (salario >= 800.01 && salario <= 1200){ 21 | reajuste = salario * 0.10; 22 | salariototal = salario + reajuste; 23 | printf("Novo salario: %.2lf\n", salariototal); 24 | printf("Reajuste ganho: %.2lf\n", reajuste); 25 | printf("Em percentual: 10 %%\n"); 26 | }else if (salario >= 1200.01 && salario <= 2000){ 27 | reajuste = salario * 0.07; 28 | salariototal = salario + reajuste; 29 | printf("Novo salario: %.2lf\n", salariototal); 30 | printf("Reajuste ganho: %.2lf\n", reajuste); 31 | printf("Em percentual: 7 %%\n"); 32 | }else if (salario > 2000){ 33 | reajuste = salario * 0.04; 34 | salariototal = salario + reajuste; 35 | printf("Novo salario: %.2lf\n", salariototal); 36 | printf("Reajuste ganho: %.2lf\n", reajuste); 37 | printf("Em percentual: 4 %%\n"); 38 | } 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /1419.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int rounds; 7 | int i; 8 | 9 | while(scanf("%d", &rounds), rounds != 0) 10 | { 11 | int mark[rounds+1], leti[rounds+1]; 12 | mark[rounds] = 0, leti[rounds] = 0; 13 | 14 | for(i = 0; i < rounds; i++) 15 | scanf("%d", &mark[i]); 16 | 17 | for(i =0; i < rounds; i++) 18 | scanf("%d", &leti[i]); 19 | 20 | int cntm =0, cntl =0, auxm, auxl, 21 | cauxm = 1, cauxl = 1; 22 | 23 | bool bonus = true; 24 | 25 | for(i = 0; i < rounds; i++) 26 | { 27 | cntm += mark[i]; 28 | cntl += leti[i]; 29 | auxm = mark[i]; 30 | auxl = leti[i]; 31 | if(bonus) 32 | { 33 | if(auxm == mark[i+1]) 34 | cauxm++; 35 | if(auxl == leti[i+1]) 36 | cauxl++; 37 | if(auxm != mark[i+1]) 38 | cauxm = 1; 39 | if(auxl != leti[i+1]) 40 | cauxl = 1; 41 | if(cauxm == 3 && cauxl == 3) 42 | bonus = false; 43 | if(cauxm == 3 && cauxl < 3) 44 | { 45 | cntm +=30; 46 | bonus = false; 47 | } 48 | if(cauxl == 3 && cauxm < 3) 49 | { 50 | cntl += 30; 51 | bonus = false; 52 | } 53 | } 54 | } 55 | if(cntm > cntl) 56 | printf("M\n"); 57 | if(cntl > cntm) 58 | printf("L\n"); 59 | if(cntm == cntl) 60 | printf("T\n"); 61 | } 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /1905.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | typedef struct Coordenada{ 6 | int x, y; 7 | bool visitada; 8 | }Coordenada; 9 | 10 | int ganhador; 11 | 12 | void procura(vector > mat, vector > coordenadas, int i, int j){ 13 | if(i >= 0 && i < 5 && j >= 0 && j < 5 && !ganhador){ 14 | coordenadas[i][j].visitada = true; 15 | if(i == 4 && j == 4) 16 | ganhador = 1; 17 | else 18 | { 19 | // vai para baixo, cima, esquerda ou direita 20 | if(i + 1 < 5 && mat[i + 1][j] == 0 && !coordenadas[i + 1][j].visitada) 21 | procura(mat, coordenadas, i + 1, j); //direita 22 | 23 | if(i - 1 >= 0 && mat[i - 1][j] == 0 && !coordenadas[i - 1][j].visitada) 24 | procura(mat, coordenadas, i - 1, j); //esquerda 25 | 26 | if(j + 1 < 5 && mat[i][j + 1] == 0 && !coordenadas[i][j + 1].visitada) 27 | procura(mat, coordenadas, i, j + 1); //baixo 28 | 29 | if(j - 1 >= 0 && mat[i][j - 1] == 0 && !coordenadas[i][j - 1].visitada) 30 | procura(mat, coordenadas, i, j - 1);//cima 31 | } 32 | } 33 | } 34 | 35 | int main(){ 36 | int T; 37 | int i, j, k; 38 | int e; 39 | 40 | cin >> T; 41 | 42 | for(i = 0; i < T; i++){ 43 | 44 | vector > mat(5); 45 | vector > coordenadas(5); 46 | 47 | for(j = 0; j < 5; j++){ 48 | mat[j].resize(5); //redimensionar 49 | coordenadas[j].resize(5);//redimensionar 50 | } 51 | 52 | for(j = 0; j < 5; j++){ 53 | for(k = 0; k < 5; k++){ 54 | cin >> e; 55 | mat[j][k] = e; 56 | 57 | coordenadas[j][k].x = j; 58 | coordenadas[j][k].y = k; 59 | coordenadas[j][k].visitada = false; 60 | } 61 | } 62 | 63 | ganhador = 0; 64 | procura(mat, coordenadas, 0, 0); 65 | 66 | if(ganhador) 67 | cout << "COPS" < 2 | 3 |

4 | 5 |

👨🏻‍💻 URI - Online Judge (Problems & Contests)

6 | 7 | > 📌 Algumas soluções para problemas do URI Online Judge. As soluções foram desenvolvidas 8 | em C e C++. 9 | 10 | O URI Online Judge é um projeto que está sendo desenvolvido pela Computer Science 11 | Departamento da URI University. O objetivo principal do projeto é fornecer programação 12 | prática e compartilhamento de conhecimento. O URI Online Judge contém mais de 1.000 problemas 13 | dividido em 8 grandes categorias. Esta divisão ajuda os usuários a se concentrar em 14 | tópicos de programação. Todos os problemas estão disponíveis em português e inglês. 15 | 16 | Os problemas podem ser resolvidos utilizando C, C++, C#, Java, Go, Ruby, Scala ou Python, competindo com os outros usuários. 17 | Como desafio, você pode melhorar seu ranking, resolver o máximo de problemas e aperfeiçoar seu código fonte. 18 | 19 | [URI - Online Judge (Problems & Contests)]: https://www.urionlinejudge.com.br/ 20 | 21 | 22 | ## O URI Online Judge passou por uma migração e mudou de nome para [BeeCrowd](https://www.beecrowd.com.br/) 23 | 24 | A BeeCrowd continua oferecendo uma ampla variedade de problemas de programação para resolver, classificados por dificuldade e tópicos específicos. Os usuários podem se cadastrar gratuitamente e enviar suas soluções para os problemas, recebendo feedback imediato sobre a correção e eficiência de seus códigos. 25 | 26 | A mudança para BeeCrowd representa uma evolução da plataforma, mantendo sua essência de fornecer um ambiente desafiador e educativo para aprimorar as habilidades de programação dos usuários. É uma comunidade ativa que continua atraindo programadores de todo o mundo em busca de desafios e aprendizado. 27 | -------------------------------------------------------------------------------- /1514.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int n, m, i, j, tmp; 6 | int matriz[100][100]; 7 | 8 | bool um(int matriz[100][100]){ 9 | bool b = true; 10 | int l; 11 | 12 | for (i = 0; i < n; ++i){ 13 | l = 0; 14 | 15 | for (j = 0; j < m; ++j) 16 | l += matriz[i][j]; 17 | 18 | if(l == m) 19 | b = false; 20 | } 21 | 22 | return b; 23 | } 24 | 25 | bool dois(int matriz[100][100]){ 26 | int tmp = 0; 27 | bool b = true, b1; 28 | 29 | for (i = 0; i < m; ++i){ 30 | b1 = false; 31 | 32 | for (j = 0; j < n; ++j) 33 | if(matriz[j][i] != 0) 34 | b1 = true; 35 | 36 | if(b1) tmp++; 37 | } 38 | 39 | if(tmp == m) return true; 40 | else 41 | return false; 42 | } 43 | 44 | bool tres(int matriz[100][100]){ 45 | bool b = true; 46 | int tmp; 47 | 48 | for (i = 0; i < m; ++i){ 49 | tmp = 0; 50 | 51 | for (j = 0; j < n; ++j) 52 | tmp += matriz[j][i]; 53 | 54 | if(tmp == n) 55 | b = false; 56 | } 57 | 58 | return b; 59 | } 60 | 61 | bool quatro(int matriz[100][100]){ 62 | int tmp = 0, tmp2 = 0; 63 | 64 | for (i = 0; i < n; ++i){ 65 | tmp = 0; 66 | 67 | for (j = 0; j < m; ++j) 68 | tmp += matriz[i][j]; 69 | 70 | if(tmp > 0) 71 | tmp2++; 72 | } 73 | 74 | if(tmp2 == n) return true; 75 | else 76 | return false; 77 | } 78 | 79 | int main() 80 | { 81 | int c; 82 | 83 | while(scanf("%d %d", &n, &m), n!= 0 && m !=0){ 84 | c = 0; 85 | 86 | for (i = 0; i < n; ++i) 87 | for (j = 0; j < m; ++j) 88 | scanf("%d", &matriz[i][j]); 89 | 90 | if(um(matriz)) 91 | c++; 92 | 93 | if(dois(matriz)) 94 | c++; 95 | 96 | if(tres(matriz)) 97 | c++; 98 | 99 | if(quatro(matriz)) 100 | c++; 101 | 102 | printf("%d\n", c); 103 | } 104 | 105 | return 0; 106 | } 107 | --------------------------------------------------------------------------------