Beecrowd Problem 1041-1060 Solve by C
Beecrowd Problem 1061
#include <stdio.h> int main(){ int h, hh, hr,m,mm,d,dm,s,ss; scanf("Dia %d",&d); scanf("%d : %d : %d\n",&h,&m,&s); scanf("Dia %d",&dm); scanf("%d : %d : %d",&hh,&mm,&ss); s = ss - s; m = mm - m; h = hh - h; d = dm - d; if(s<0){ s+=60; m--; } if(m<0){ m+=60; h--; } if(h<0){ h+=24; d--; } printf("%d dia(s)\n", d); printf("%d hora(s)\n", h); printf("%d minuto(s)\n", m); printf("%d segundo(s)\n", s); return 0; }
Beecrowd Problem 1062
Beecrowd Problem 1063
#include <stdio.h> int main() { int X, Y; float price = 0; scanf("%d %d", &X, &Y); if (X == 1) { price = (float) (4.00 * Y); } else if (X == 2) { price = (float) (4.50 * Y); } else if (X == 3) { price = (float) (5.00 * Y); } else if (X == 4) { price = (float) (2.00 * Y); } else if (X == 5) { price = (float) (1.50 * Y); } printf("Total: R$ %.2f\n", price); return 0; }
Beecrowd Problem 1064
#include <stdio.h> int main() { float num,sum=0; int i,count=0; for(i=1;i<=6;i++){ scanf("%f",&num); if(num>0){ sum = sum + num; count++; } } float average = sum/count; printf("%d valores positivos\n",count); printf("%.1f\n",average); return 0; }
Beecrowd Problem 1065
#include <stdio.h> int main() { int i,num,count=0; for(i=1;i<=5;i++){ scanf("%d",&num); if(num%2==0){ count++; } } printf("%d valores pares\n",count); return 0; }
Beecrowd Problem 1066
#include <stdio.h> int main() { int i,num,even=0,odd=0,positive=0,negative=0; for(i=1;i<=5;i++){ scanf("%d",&num); if(num%2==0){ even++; } if(num%2!=0){ odd++; } if(0<num){ positive++; } if(0>num){ negative++; } } printf("%d valor(es) par(es)\n",even); printf("%d valor(es) impar(es)\n",odd); printf("%d valor(es) positivo(s)\n",positive); printf("%d valor(es) negativo(s)\n",negative); return 0; }
Beecrowd Problem 1067
#include<stdio.h> int main() { int n,i; scanf("%d",&n); for(i=1;i<=n;i++){ if(i%2!=0){ printf("%d\n",i); } } }
Beecrowd Problem 1068
Beecrowd Problem 1069
Beecrowd Problem 1070
#include <stdio.h> int main() { int n, i=0; scanf("%d", &n); while(i < 6){ if(n%2!=0){ printf("%d\n", n); i++; } n++; } return 0; }
Beecrowd Problem 1071
#include <stdio.h> int main() { int x, y, sum = 0, i; int min, max; scanf("%d%d", &x,&y); if(x < y){ min = x; max = y; }else{ max = x; min = y; } for(i = (min + 1); i < max; ++i) { if(i % 2 != 0){ sum += i; } } printf("%d\n", sum); return 0; }
Beecrowd Problem 1072
#include <stdio.h> int main() { int x, a, i; int in = 0; int out = 0; scanf("%d", &x); for(i = 0; i < x; i++) { scanf("%d", &a); if(a >= 10 && a <= 20){ in++; }else{ out++; } } printf("%d in\n", in); printf("%d out\n", out); return 0; }
Beecrowd Problem 1073
#include<stdio.h> int main() { int n,i; scanf("%d",&n); for(i=2;i<=n;i+=2) { printf("%d^2 = %d\n",i,i*i); } return 0; }
Beecrowd Problem 1074
#include <stdio.h> int main() { int N,X,a; scanf ("%d", &N); for(a=1;a<=N;a++) { scanf ("%d",&X); if(X==0) printf("NULL\n"); else if(X<=0&&X%2==0) printf ("EVEN NEGATIVE\n"); else if(X<=0&&X%2==-1) printf ("ODD NEGATIVE\n"); else if(X>=0&&X%2==0) printf ("EVEN POSITIVE\n"); else if(X>=0&&X%2==1) printf ("ODD POSITIVE\n"); } return 0; }
Beecrowd Problem 1075
#include<stdio.h> int main() { int i,n; scanf("%d",&n); for(i=1;i<=10000;i++){ if(i%n==2){ printf("%d\n",i); } } }
Beecrowd Problem 1076
Beecrowd Problem 1077
Beecrowd Problem 1078
#include<stdio.h> int main() { int i,n; scanf("%d",&n); for(i=1;i<=10;i++){ printf("%d x %d = %d\n",i,n,i*n); } }
Beecrowd Problem 1079
#include<stdio.h> int main() { int n,i; float a,b,c,sum,avg; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%f %f %f",&a,&b,&c); sum=a*2+b*3+c*5; avg=sum/(2+3+5); printf("%.1f\n",avg); } return 0; }
Beecrowd Problem 1080
#include<stdio.h> int main() { int i,j = 0,p,arr[100]; for (i = 0;i < 100;i++){ scanf("%d", &arr[i]); } for(i = 0;i < 100;i++){ if(arr[i] > j){ j = arr[i]; p = i+1; } } printf("%d\n", j); printf("%d\n", p); return 0; }
Leave a Reply