Submission #6731269


Source Code Expand

r,n,m = gets.split.map(&:to_i)
ans = 0.0
(1...n).each do |i|
    j = (i*2 < n ? i : n-i).to_f
    s = 4*r*(j/n*(1-j/n))**(0.5)
    ans += s if ((i-m)*2-n).abs > (i*2-n).abs
    ans += s if ((i+m)*2-n).abs >= (i*2-n).abs
end
puts ans

Submission Info

Submission Time
Task B - ステップカット
User koikotya
Language Ruby (2.3.3)
Score 200
Code Size 240 Byte
Status AC
Exec Time 72 ms
Memory 1916 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 7 ms 1788 KB
00_example_02.txt AC 7 ms 1788 KB
00_example_03.txt AC 72 ms 1916 KB
10_rand_01.txt AC 7 ms 1788 KB
10_rand_02.txt AC 7 ms 1788 KB
10_rand_03.txt AC 34 ms 1788 KB
10_rand_04.txt AC 8 ms 1788 KB
10_rand_05.txt AC 11 ms 1788 KB
10_rand_06.txt AC 9 ms 1788 KB
10_rand_07.txt AC 18 ms 1788 KB
10_rand_08.txt AC 13 ms 1788 KB
20_hand_01.txt AC 70 ms 1788 KB
20_hand_02.txt AC 72 ms 1788 KB
20_hand_03.txt AC 66 ms 1788 KB
20_hand_04.txt AC 7 ms 1788 KB
20_hand_05.txt AC 7 ms 1788 KB