Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:这个程序挺简单的,为什么过不了呢?In Reply To:这个程序挺简单的,为什么过不了呢? Posted by:20091845 at 2010-07-21 10:05:36 > #include<stdio.h> > #include<math.h> > #define PAI 3.1415 > main() > { > float a,b,s;int n,i=1,x; > scanf("%d",&n); > while(n>0) > { > scanf("%f %f",&a,&b); > s=PAI*(a*a+b*b)/2.0; > x=s/50; > printf("Property %d: This property will begin eroding in year d\n",i,x+1); > n--; > i++; > } 如果刚好可以被50整出的话,x+1就不对了吧,可以试一下ceil函数,前面要加<math.h> 或者看一下能不能被50整除,分两种情况。 > printf("END OF OUTPUT.\n"); > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator