Submission #4013696


Source Code Expand

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

int main(){
  double R; int N,M; cin >> R >> N >> M;
  double length[100001];
  for(int i=0; i<=N; i++){
    length[i]=2*R*sqrt(1-abs(1-2*(double)i/N)*abs(1-2*(double)i/N));
  }
  double result=0;
  for(int i=1; i<=N+M-1; i++){
    if(i<=N&&i-M>=0){
      result+=max(length[i],length[i-M]);
    }else if(i<=N){
      result+=length[i];
    }else if(i-M>=0){
      result+=length[i-M];
    }
  }
  cout << fixed << setprecision(10) << result << endl;
}

Submission Info

Submission Time
Task B - ステップカット
User awageppo
Language C++14 (GCC 5.4.1)
Score 200
Code Size 519 Byte
Status AC
Exec Time 3 ms
Memory 1024 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 1 ms 256 KB
00_example_02.txt AC 1 ms 256 KB
00_example_03.txt AC 3 ms 1024 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 640 KB
10_rand_04.txt AC 1 ms 256 KB
10_rand_05.txt AC 1 ms 256 KB
10_rand_06.txt AC 1 ms 256 KB
10_rand_07.txt AC 2 ms 384 KB
10_rand_08.txt AC 1 ms 384 KB
20_hand_01.txt AC 3 ms 1024 KB
20_hand_02.txt AC 3 ms 1024 KB
20_hand_03.txt AC 3 ms 1024 KB
20_hand_04.txt AC 1 ms 256 KB
20_hand_05.txt AC 1 ms 256 KB