一.1.第一季10题全(注:第五题问题已经解决,确认AC!)#include <stdio.h>int main(){int a,b,sum;scanf("%d%d",&a,&b);sum=a+b;printf("%d\n",sum);return 0;}2.#include <stdio.h>#define PI 3.1415926int main(){double r,h,l,s,sq,vq,vz;scanf("%lf%lf",&r,&h);l=2*PI*r;s=PI*r*r;sq=4*PI*r*r;vq=4*PI*r*r*r/3;vz=s*h;printf("%.2lf\n%.2lf\n%.2lf\n%.2lf\n%.2lf\n", l,s,sq,vq,vz);return 0; }3.#include <stdio.h>int main(){int a,b,c;double d,e;scanf("%d%d%d",&a,&b,&c); d=a+b+c;e=d/3;printf("%lf\n%lf\n",d,e);return 0;}4.#include <stdio.h>int main(){int a,b,c;scanf("%d%d%d",&a,&b,&c); if(a<b)a=b;if(a<c)a=c;printf("%d\n",a);return 0;}5.#include<stdio.h>int main(){int i=0,j=0,k=1;char a[6];while((a[i]=getchar())!='\n') {i++;}for(;i>0;i--){if(a[j]==a[i-1]){ j++;continue;}else {k=0;break;}}if(k==1)printf("yes\n"); elseprintf("no\n"); }6.#include<stdio.h>int main(){double a,c;scanf("%lf",&a);switch((int)a/10){case 0:c=a*0.1;break;case 1:c=(a-10)*0.075+10*0.1;break;case 2:case 3:c=(a-20)*0.05+10*0.075+10*0.1;br eak;case 4:case 5:c=(a-40)*0.03+20*0.05+10*0.075+1 0*0.1;break;case 6:case 7:case 8:case 9:c=(a-60)*0.015+20*0.03+20*0.05+1 0*0.075+10*0.1;break;default:c=(a-100)*0.01+40*0.015+20*0 .03+20*0.05+10*0.075+10*0.1;}printf("%lf\n",c);return 0;}7.#include<stdio.h>int main(){double a,b,c;scanf("%lf",&a);c=(int)a;if(a>c)a=c+1;if(a>15)b=(a-15)*2.1+7+13*1.5; else {if(a>2)b=(a-2)*1.5+7;else b=7;}printf("%lf\n",b);return 0; }8.#include <stdio.h>int main(){int a,b,c,e,f=30,g=31,n;scanf("%d-%d-%d",&a,&b,&c);if((a%400==0)||(a%100!=0&&a%4==0)) e=29;elsee=28;switch (b){case 1:n=c;break;case 2:n=g+c;break;case 3:n=g+e+c;break;case 4:n=g+e+g+c;break;case 5:n=g+e+g+f+c;break;case 6:n=g+e+g+f+g+c;break;case 7:n=g+e+g+f+g+f+c;break;case 8:n=g+e+g+f+g+f+g+c;break;case 9:n=g+e+g+f+g+f+g+g+c;break;case 10:n=g+e+g+f+g+f+g+g+f+c;break; case 11:n=g+e+g+f+g+f+g+g+f+g+c;break; default: n=g+e+g+f+g+f+g+g+f+g+f+c;}printf("%d\n",n);return 0;}9.#include <stdio.h> int main(){int x;scanf("%d",&x);if(x>=90&&x<=100) printf("A\n");else if (x>=80)printf("B\n");else if (x>=70)printf("C\n");else if (x>=60)printf("D\n");elseprintf("E\n");return 0;}10.#include<stdio.h>int main(){double x,y,s;scanf("%lf,%lf",&x,&y);s=(x+2)*(x+2)+(y-2)*(y-2); if(s>1){s=(x+2)*(x+2)+(y+2)*(y+2); if(s>1){s=(x-2)*(x-2)+(y+2)*(y+2);if(s>1){s=(x-2)*(x-2)+(y-2)*(y-2);if(s>1){printf("0\n");return 1;} }}}printf("10\n");return 0;}二。
第二季15题全11.#include<stdio.h>int main(){int x=0,a=0,c=0,i=1;scanf("%d%d",&x,&a);c=x;for(i=1;i<a;i++){c=(c*x)%1000;};if(c<100){if(c<10)printf("00%d\n",c);elseprintf("0%d\n",c);};if(c>=100)printf("%d\n",c);return 0;}12.#include<stdio.h>int main(){int i=1,a=0,b=0,c=1016,k=1;for(;k=1;){c=c+4;a=c;b=c;for(i=1;i<=4;i++){a=a/4*5+1;if(a%4!=0){k=0;;};};a=a/4*5+1;if(k==1){printf("%d %d\n",a,b);break;};};return 0;}13。
#include<stdio.h>#include<math.h>int main(){int i=1,n=0,b=0;double j=0,k=0,m=0;scanf("%d",&n);for(;i<=n;i++){b=i%2-1;k=pow(-1,b);m=pow(2,i);j+=k*m/(m-k)/(2*m+k);};printf("%.6lf\n",j);return 0;}14.#include<stdio.h>#include<math.h>int main(){int a=0,b=0,i=0,t;scanf("%d%d",&a,&b);if(a>b) {t=a;a=b;b=t;}for(;a<=b;a++){ int m=1;for(i=2;i<=sqrt(a);i++){if(a%i==0){m=0;break;};}if(m==1)printf("%d ",a);}printf("\n");return 0;}15.#include<stdio.h>#include<math.h>int main(){int a=0,b=0,c=0;scanf("%d",&a);b=(int)pow(a,2);c=(int)pow(a,3);if(a%2){ printf("%d*%d*%d=%d=%d",a,a,a,c,b-a/2*2);int n=1;for(;n<a;n++){printf("+%d",b-a/2*2+2*n);}printf("\n");};if(a%2==0){int n=1;printf("%d*%d*%d=%d=%d",a,a,a,c,b+1-a);for(;n<a;n++){printf("+%d",b+1-a+n*2);}printf("\n");};return 0;}16#include<stdio.h>#include<math.h>int main(){int a=0,b=0,c=0,d=0,e=0,x=0,y=0,z=0,u=0,v=0;double f=0;for(a=0;a<=2;a++){double m=0;for(b=0;b<=(20-8*a)/5;b++){for(c=0;c<=(20-8*a-5*b)/3;c++){for(d=0;d<=(20-8*a-5*b-3*c)/2;d++){e=20-8*a-5*b-3*c-2*d;m=2000*pow(1+0.0084*12*8,a)*pow(1+0.0075*12*5,b)*pow(1+0.0069*12*3,c)*pow(1+0.0066 *12*2,d)*pow(1+0.0063*12,e);if(f<m){f=m;x=a,y=b,z=c,u=d,v=e;};};};};};printf("%d %d %d %d %d\n%.2lf\n",x,y,z,u,v,f);return 0;}17.#include<stdio.h>#include<math.h>int main(){double a=0;int i=0,b=0;scanf("%lf",&a);b=(int)a;for(;(int)(b/pow(10,i));)i++;printf("%d\n",i);return 0;}18。