UVA 10499 The Land of Justice

政府在数学家的帮助下解决商业困境,通过调整产品销售单位来最大化利润,并请求程序员开发计算工具。输入为分割固体球的数量,输出为利润百分比。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Problem H
The Land of Justice
Input: standard input
Output: standard output
Time Limit: 4 seconds

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*25即可
输入只有正数
代码如下:
#include <stdio.h>
int main(void)
{
    long long int n;
    while(scanf("%lld",&n)&&n>0)
    {
     if(n==1)
      printf("0%%\n");
     else
      printf("%lld%%\n",25*n);
    }
    return 0;
} 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值