Submission #967610


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

double f(int i,long long N,double R){
	if( i <= 0 or i > N ) return 0;
	double y = 1.0 * i / N * (2*R) - R;
	//cout << y << endl;
	double x = sqrt(R*R-y*y);
	return x;
}
void solve(long long R, long long N, long long M){
	map<int,int> C;
	double ans = 0;
	for(int i = 1 ; i < N + M ; i++){
		ans += 2*max(f(i,N,R),f(i-M,N,R));
		//cout << f(i,N) << " " << f(i-M,N) << endl;
	}
	printf("%.10lf\n",ans);
}



int main(){	
	ios::sync_with_stdio(false);
	long long M;
	long long N;
	long long R;
	cin >> R;
	cin >> N;
	cin >> M;
	solve(R, N, M);
	return 0;
}

Submission Info

Submission Time
Task B - ステップカット
User kyuridenamida
Language C++14 (GCC 5.4.1)
Score 200
Code Size 633 Byte
Status AC
Exec Time 4 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 16
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 3 ms 256 KB
00_example_02.txt AC 3 ms 256 KB
00_example_03.txt AC 4 ms 256 KB
10_rand_01.txt AC 3 ms 256 KB
10_rand_02.txt AC 3 ms 256 KB
10_rand_03.txt AC 3 ms 256 KB
10_rand_04.txt AC 3 ms 256 KB
10_rand_05.txt AC 3 ms 256 KB
10_rand_06.txt AC 3 ms 256 KB
10_rand_07.txt AC 3 ms 256 KB
10_rand_08.txt AC 3 ms 256 KB
20_hand_01.txt AC 4 ms 256 KB
20_hand_02.txt AC 4 ms 256 KB
20_hand_03.txt AC 4 ms 256 KB
20_hand_04.txt AC 3 ms 256 KB
20_hand_05.txt AC 3 ms 256 KB