SGU 417. Heavy Disc(水题)

97 篇文章 0 订阅

417. Heavy Disc
Time limit per test: 0.5 second(s) 
Memory limit: 262144 kilobytes
input: standard 
output: standard



Consider a heavy disc on the plane, centered at (  x  0y  0) with radius  r, with the origin strictly outside it. The density of the disc is given by formula 

 

What is the mass of the disc? 

Input
The input file contains three integer numbers  x  0y  0r (-100 ≤  x  0y  0 ≤ 100, 1 ≤  r ≤ 100,  x  0  2y  0  22). 

Output
Output one real number — the mass of the disc. Your answer will be considered correct if it is within 10  -12 relative error of the exact answer. 

Example(s)
sample input
sample output
3 4 2
40.449586576894895




Online Contester Team © 2002 - 2010. All rights reserved.
Input
The input file contains three integer numbers  x  0y  0r (-100 ≤  x  0y  0 ≤ 100, 1 ≤  r ≤ 100,  x  0  2y  0  22).
Output
Output one real number — the mass of the disc. Your answer will be considered correct if it is within 10  -12 relative error of the exact answer.
Sample Input
sample input
sample output
3 4 2
40.449586576894895


题解:

乍一看以为要积分求公式。。求了半天后来发现根本没法求,这题很迷,总感觉题目有歧义,只要用圆心密度乘圆面积就能a,excuse me!!??做出来的应该都是没法求凑到的答案,因为这题真的很垃圾,感觉没有任何意义

代码:

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<queue>
#include<stack>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<stdlib.h>
#include<cmath>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
#define lson k*2
#define rson k*2+1
#define M (t[k].l+t[k].r)/2
#define ll long long
#define INF 10086111
const double pi=acos(0)*2;
int main()
{
	double x,y,r,r1,r2;
	while(scanf("%lf%lf%lf",&x,&y,&r)!=EOF)
    {
        printf("%.12lf\n",pi*r*r*log(x*x+y*y));
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值