UVa_10499 - The Land of Justice
2014-06-19 20:41
281 查看
题意有点绕,看了一会儿,才明白,是将一个球n等分,计算增加的表面积的比例。
球的表面积是4*π*r^2:
当n=2,增加了2*π*r^2,增加了50%;n=3,是75%;以此类推,每多一个,增加25%
注意:
1.坑爹的Wrong了几次,发现是while(scanf("%lld",&N)==1&&N!=-1)错误了,应该把N!=-1改为N>0,因为题意是一个负数结尾,不是-1。
2.long long 表示,int范围不够
球的表面积是4*π*r^2:
当n=2,增加了2*π*r^2,增加了50%;n=3,是75%;以此类推,每多一个,增加25%
注意:
1.坑爹的Wrong了几次,发现是while(scanf("%lld",&N)==1&&N!=-1)错误了,应该把N!=-1改为N>0,因为题意是一个负数结尾,不是-1。
2.long long 表示,int范围不够
#include<stdio.h> int main() { long long N,percentage; while(scanf("%lld",&N)==1&&N>0) { if(N==1) percentage=0; else percentage=25*N; printf("%lld%%\n",percentage); } return 0; }
相关文章推荐
- UVa 10499 - The Land of Justice
- uva 10499 The Land of Justice(公式应用)
- UVA - 10499 The Land of Justice
- UVA - 10499 The Land of Justice
- UVA - 10499 The Land of Justice
- UVA 10499 - The Land of Justice(数学)
- UVa 10499 - The Land of Justice
- uva-10499 - The Land of Justice
- UVa 10499 - The Land of Justice
- uva 10499 - The Land of Justice
- UVa 10499 The Land of Justice(简单数学)
- uva 10499 The Land of Justice
- UVA - 10499 The Land of Justice
- uva 10499 - The Land of Justice
- Uva 10499 - The Land of Justice
- uva 10499 The Land of Justice
- UVA 10499 The Land of Justice
- UVA 10499 The Land of Justice
- UVA 10499 (暑假-数学 -H - The Land of Justice)
- UVa 10499 - The Land of Justice