资源描述:
《西方大c语言poj练习答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、一.1.第一季10题全(注:第五题问题已经解决,确认AC!)#include int main(){ int a,b,sum; scanf("%d%d",&a,&b); sum=a+b; printf("%d",sum); return 0;}2.#include #define PI 3.1415926int main(){ double r,h,l,s,sq,vq,vz; scanf("%lf%lf",&r,&h); l=2*PI*r; s=PI
2、*r*r; sq=4*PI*r*r; vq=4*PI*r*r*r/3; vz=s*h; printf("%.2lf%.2lf%.2lf%.2lf%.2lf",l,s,sq,vq,vz); return 0;}3.#include 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%lf",d,e); retur
3、n 0;}4.#include int main(){ int a,b,c; scanf("%d%d%d",&a,&b,&c); if(aint main(){ int i=0,j=0,k=1; char a[6]; while((a[i]=getchar())!='') { i++; } for(
4、;i>0;i--){ if(a[j]==a[i-1]){ j++; continue;} else {k=0; break;} } if(k==1) printf("yes"); else printf("no");}6.#includeint main(){ double a,c; scanf("%lf",&a); switch((int)a/10) { case 0:c=a*0.1;brea
5、k; 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;break; case 4: case 5:c=(a-40)*0.03+20*0.05+10*0.075+10*0.1;break; case 6: case 7: case 8: case 9:c=(a-60)*0.015+20*0.03+20*0.0
6、5+10*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",c); return 0;}7.#includeint 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、+7+13*1.5; else { if(a>2) b=(a-2)*1.5+7; else b=7; } printf("%lf",b); return 0;}8.#include int main(){ int a,b,c,e,f=30,g=31,n; scanf("%d-%d-%d",&a,&b,&c); if((a%400==0)
8、
9、(a%100!=0&&a%4==0)) e=29; else e=28;
10、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