首页 > 其他 > 详细

UVA10499 The Land of Justice【水题】

时间:2019-02-17 20:02:33      阅读:146      评论:0      收藏:0      [点我收藏+]

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 < 2^31), 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%

问题链接UVA10499 The Land of Justice
问题简述:(略)
问题分析
????一个球切n刀,问表面积增加多少百分比。
????球面积4πr^2,圆面积πr^2,每切一刀增加25%。需要注意,切1刀不增加。还需要注意要使用long long类型。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA10499 The Land of Justice */

#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n;
    while(~scanf("%lld", &n) && n >0)
        printf("%lld%%\n", (n == 1) ? 0 : n * 25);

    return 0;
}

UVA10499 The Land of Justice【水题】

原文:https://www.cnblogs.com/tigerisland45/p/10392274.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!