Submission #4483996
Source Code Expand
#include "bits/stdc++.h" #include <cmath> #define ALL(x) x.begin(), x.end() #define LEN(x) (int)x.size() #define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0) using namespace std; typedef int64_t i64; typedef pair<int,int> pii; template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;} template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;} constexpr int INF = 0x3f3f3f3f; signed main() { int R, N, M; double len[200100] {}; cin >> R >> N >> M; const double P = (double)2*R / (double)N; for (int l = 1, r = N-1; l <= r; ++l, --r) { const double w = ((double)R - P*l); len[l] = len[r] = 2 * sqrt((double)R*R - w*w); } auto getlen = [&](int i) { return (i < 0 || i >= N)? 0.0 : len[i]; }; double ans = 0; for (int i = 1; i < (N+M); ++i) { ans += fmax(getlen(i), getlen(i-M)); } cout << fixed << setprecision(10) << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - ステップカット |
User | Arumakan1727 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1019 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 1792 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 | 2 ms | 1792 KB |
00_example_02.txt | AC | 2 ms | 1792 KB |
00_example_03.txt | AC | 3 ms | 1792 KB |
10_rand_01.txt | AC | 2 ms | 1792 KB |
10_rand_02.txt | AC | 2 ms | 1792 KB |
10_rand_03.txt | AC | 2 ms | 1792 KB |
10_rand_04.txt | AC | 2 ms | 1792 KB |
10_rand_05.txt | AC | 2 ms | 1792 KB |
10_rand_06.txt | AC | 2 ms | 1792 KB |
10_rand_07.txt | AC | 2 ms | 1792 KB |
10_rand_08.txt | AC | 2 ms | 1792 KB |
20_hand_01.txt | AC | 3 ms | 1792 KB |
20_hand_02.txt | AC | 3 ms | 1792 KB |
20_hand_03.txt | AC | 3 ms | 1792 KB |
20_hand_04.txt | AC | 2 ms | 1792 KB |
20_hand_05.txt | AC | 2 ms | 1792 KB |