UPC 组队训练 K: Harbin Sausage(水题)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/a17865569022/article/details/82426646

问题 K: Harbin Sausage
时间限制: 1 Sec 内存限制: 128 MB
提交: 60 解决: 51
[提交] [状态] [讨论版] [命题人:admin]
题目描述
Harbin Sausage is a kind of food usually made from ground meat, such as pork, beef along with salt and spices. The sausage has a history of over 100 years. Because the surface color of it is date red, people call it red sausage or Harbin sausage.

Harbin Sausage is reputable all over the country; it has now become the daily necessity for Harbin people to welcome friends and guests. The procedure is a little bit complicated. First, season the meat and put it in fridge for two or three days. Second, stir the meat with starch till it becomes meatballs. Third, fill the meat into the casing with special tools. Fourth, put it into a toaster oven for 1 hour at most. But the finished product is tasty. You can eat it directly, or match it with other dishes and Harbin beer.
(The above is quoted from http://www.chinatours.com/travel-guide/harbin/food/harbin-sausage.html)
A sausage can be regarded as a cylinder(圆柱体) attached with a hemisphere(半球) in each ends. The height of the cylinder is H, and the radius of both the cylinder and the hemispheres is R. You can see the following three views(三视图) to get a better understanding:
这里写图片描述
Now you are going to buy a sausage in the Mysterious Sausage Store. Given H and R (both are integers), please calculate how much you should pay. For convenience, the price of per unit volume(单位体积) is set to be 3/Pi(圆周率), and thus the answer is obviously a integer.

输入
One line containing H and R, 1 ≤ H, R ≤ 100

输出
One line containing the amount of money you should pay for this sausage.

样例输入
5 6

样例输出
1404

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,r;
    cin>>h>>r;
    int sum=3*r*r*h+4*r*r*r;
    cout<<sum<<endl;
    return 0;
}

猜你喜欢

转载自blog.csdn.net/a17865569022/article/details/82426646
今日推荐