417. Heavy Disc
Time limit per test: 0.5 second(s)
Memory limit: 262144 kilobytes
Memory limit: 262144 kilobytes
input: standard
output: standard
output: standard
Consider a heavy disc on the plane, centered at ( x 0, y 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
0,
y
0,
r (-100 ≤
x
0,
y
0 ≤ 100, 1 ≤
r ≤ 100,
x
0
2+
y
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. |
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;
}