Submission #3993751
Source Code Expand
#include <iostream> #include <vector> #include <queue> #include <map> #include <set> #include <list> #include <deque> #include <string> #include <algorithm> #include <cmath> #include <ctype.h> using namespace std; #define dump(a) cout << (a) << '\n'; typedef long long Int; Int mod = 1e9+7; Int MOD = 998244353; int main() { ios::sync_with_stdio(false); double r, n, m; cin >> r >> n >> m; double res = 0; vector<double> cut; for (double i = 0; i <= n; i+=1.0) { double x = 2.0 * r / n; double a = x * i; cut.push_back(sqrt(r*r - (r-a)*(r-a)) * 2.0); } for (Int i = 0; i < n + m; i++) { if (i-m < 0) res += cut[i]; else if (i < (Int)cut.size()) { res += max(cut[i-m], cut[i]); } else { res += cut[i-m]; } } printf("%.12lf\n", res); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - ステップカット |
User | keep_OC |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 917 Byte |
Status | AC |
Exec Time | 4 ms |
Memory | 1400 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt |
All | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 10_rand_06.txt, 10_rand_07.txt, 10_rand_08.txt, 20_hand_01.txt, 20_hand_02.txt, 20_hand_03.txt, 20_hand_04.txt, 20_hand_05.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 1 ms | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
00_example_03.txt | AC | 3 ms | 1400 KB |
10_rand_01.txt | AC | 1 ms | 256 KB |
10_rand_02.txt | AC | 1 ms | 256 KB |
10_rand_03.txt | AC | 2 ms | 892 KB |
10_rand_04.txt | AC | 1 ms | 256 KB |
10_rand_05.txt | AC | 1 ms | 384 KB |
10_rand_06.txt | AC | 1 ms | 384 KB |
10_rand_07.txt | AC | 2 ms | 640 KB |
10_rand_08.txt | AC | 2 ms | 512 KB |
20_hand_01.txt | AC | 3 ms | 1400 KB |
20_hand_02.txt | AC | 4 ms | 1400 KB |
20_hand_03.txt | AC | 3 ms | 1400 KB |
20_hand_04.txt | AC | 1 ms | 256 KB |
20_hand_05.txt | AC | 1 ms | 256 KB |