UVa 10499 The Land of Justice(简单数学)
2013-08-06 20:11
411 查看
10499 - The Land of Justice
Time limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1440
In the Land of Justice the selling price of everything is fixed all over the country. Nobody can buy a thing and sell it in double price. But, that created problems for the businessmen. They left
their business and went to the production. So, after some days everybody was in production and nobody in business. And the people didn't get their necessary things though the country was self-sufficient in every sector.
The government became very much anxious. But, they were intelligent enough to call the mathematicians.
The mathematicians gave a solution. They suggested setting the surface area of an object as its selling-unit instead of its volume. Actually the clever mathematicians were very much interested to
establish their own business.
Now, the government asks the programmers to build the software that would calculate the profit things.
Here your job is to calculate the business profit for a solid sphere. A businessman buys a complete sphere and to maximize his profit he divides it in n equal parts. All cut should
go through the axis of the sphere. And every part should look like the picture below:
Input
You are given a sequence of integers N (0 < N < 231), indicating the numbers of parts of the sphere. The input file is terminated with a negative number. This number should not be processed.
Output
Calculate the profit over the sold pieces. The result should be in percentage and rounded to the nearest integer.
Sample input
2
2
-1
Sample output
50%50%
题意:
一个球,从轴部n等分,求多出的表面积是原来表面积的百分之几。
思路:
n等分相当于多出了n个圆,也就是多出了球体表面积的25n%
数据超int,要用long long。
完整代码:
/*0.025s*/ #include<cstdio> int main() { long long n; while (scanf("%lld", &n), n > 0) printf("%lld%%\n", n == 1 ? 0 : 25 * n); return 0; }
相关文章推荐
- UVA 10499 - The Land of Justice(数学)
- UVA 10499 (暑假-数学 -H - 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
- UVA10499- 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