Submission #7962990
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main() { int R, N, M; cin >> R >> N >> M; vector<long double> rr( N + 1 ); if( N % 2 == 0 ) { for( int i = 1; i < N; i++ ) { rr[i] = (long double)2 * R * abs( N / 2 - i) / N; rr[i] *= rr[i]; } } else { for( int i = 1; i < N; i++ ) { rr[i] = (long double)2 * R * min( abs( N / 2 - i ), abs( N / 2 + 1 - i ) ) / N + (long double)R / N; rr[i] *= rr[i]; } } long double ans = 0; long double rr2 = (long double)R * R; for( int i = 1; i <= N + M - 1; i++ ) { long double l1 = 0; if( i < N ) { l1 = sqrt( rr2 - rr[i] ); } long double l2 = 0; if( i - M > 0 ) { l2 = sqrt( rr2 - rr[i - M] ); } long double l3 = max( l1, l2 ); ans += l3 * 2; } cout << fixed << setprecision(12) << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - ステップカット |
User | forest3 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 831 Byte |
Status | AC |
Exec Time | 4 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 | 1 ms | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
00_example_03.txt | AC | 4 ms | 1792 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 | 896 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 | 256 KB |
10_rand_07.txt | AC | 2 ms | 512 KB |
10_rand_08.txt | AC | 1 ms | 384 KB |
20_hand_01.txt | AC | 4 ms | 1792 KB |
20_hand_02.txt | AC | 4 ms | 1792 KB |
20_hand_03.txt | AC | 4 ms | 1792 KB |
20_hand_04.txt | AC | 1 ms | 256 KB |
20_hand_05.txt | AC | 1 ms | 256 KB |