Submission #978127


Source Code Expand

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

double r, n, m;
double func(double d) {
	double k = abs(d - r);
	return sqrt(r*r - k*k) * 2;
}
int main() {
	scanf("%lf%lf%lf", &r, &n, &m);
	double cnt = 0;
	for (double i = 1; i <= n + m - 1; i++) {
		double t = i - m;
		if (t <= 0)cnt += func(r * 2 / n*i);
		else if (i >= n)cnt += func(r * 2 / n*t);
		else cnt += max(func(r * 2 / n*i), func(r * 2 / n*t));
	}
	printf("%.16lf\n", cnt);
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lf%lf%lf", &r, &n, &m);
                                ^

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