资源描述:
《西工大C语言POJ习题答案.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、.一.1.第一季10题全(注:第五题问题已经解决,确认AC!)#include int main(){ int a,b,sum; scanf("%d%d",&a,&b); sum=a+b; printf("%d",sum); return 0;}..一.1.第一季10题全(注:第五题问题已经解决,确认AC!)#include int main(){ int a,b,sum; scanf("%d%d",&a,&b); sum=a+b; printf("%d",sum); retur
2、n 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*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
3、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); return 0;}..4...#include int main(){ int a,b,c; scanf("%d%d%d",&a,&b,&c); if(a4、o.h>int main(){ int i=0,j=0,k=1; char a[6]; while((a[i]=getchar())!='') {.. i++; } for(;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 mai
5、n(){ 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;break; case 4:.. case 5:c=(a-40)*0.03+20*0.05+10*0.075+10*0.1;break; case
6、 6: case 7: case 8: case 9:c=(a-60)*0.015+20*0.03+20*0.05+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",&
7、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",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%10
10、0!=0&&a%4==0)) e=29; else e=28; switch (b) { case 1:n=c;break; case 2: