-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathA.cc
executable file
·57 lines (41 loc) · 1.5 KB
/
A.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foreach(it, v) for(auto it=(v).begin(); it != (v).end(); ++it)
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}
template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}
template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
const ld PI = 3.1415926535897932384626433832795;
ld get(ld a, ld b, ld x){
a *= a;
b *= b;
return (PI * b / a) * (a * x - (x*x*x/3.0));
}
int main(){
ld a, b; int n;
cin >> a >> b >> n;
a /= 2;
b /= 2;
ld step = (2.0/n);
swap(b, a);
for(int i = 0; i < n; i++){
cout << fixed << setprecision(6) << (get(a, b, -a + (step*a*(i+1))) - get(a, b, -a + (step*a*i))) << endl;
}
return 0;
}