結果

問題 No.764 浮動点
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-27 08:01:39
言語 Ruby
(3.2.2)
結果
AC  
実行時間 124 ms / 1,500 ms
コード長 303 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 16,336 KB
最終ジャッジ日時 2023-10-22 01:40:05
合計ジャッジ時間 5,400 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
16,168 KB
testcase_01 AC 86 ms
16,112 KB
testcase_02 AC 87 ms
16,112 KB
testcase_03 AC 94 ms
16,188 KB
testcase_04 AC 106 ms
16,112 KB
testcase_05 AC 90 ms
16,176 KB
testcase_06 AC 109 ms
16,180 KB
testcase_07 AC 93 ms
16,172 KB
testcase_08 AC 110 ms
16,112 KB
testcase_09 AC 93 ms
16,172 KB
testcase_10 AC 113 ms
16,112 KB
testcase_11 AC 99 ms
16,184 KB
testcase_12 AC 114 ms
16,112 KB
testcase_13 AC 116 ms
16,112 KB
testcase_14 AC 116 ms
16,276 KB
testcase_15 AC 116 ms
16,240 KB
testcase_16 AC 122 ms
16,272 KB
testcase_17 AC 118 ms
16,272 KB
testcase_18 AC 115 ms
16,112 KB
testcase_19 AC 114 ms
16,164 KB
testcase_20 AC 116 ms
16,336 KB
testcase_21 AC 124 ms
16,328 KB
testcase_22 AC 116 ms
16,112 KB
testcase_23 AC 121 ms
16,112 KB
testcase_24 AC 122 ms
16,272 KB
testcase_25 AC 91 ms
16,276 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

include Math
n=gets.to_i
l=(0..n+1).map{gets.to_f}
k=l[0]
f=->(r,s){r-s>k ?PI*s*s:s-r>k ?PI*r*r:r+s<k ?0:(x=(k*k+r*r-s*s)/2/k;h=sqrt(r*r-x*x);r*r*atan2(h,x)+s*s*atan2(h,k-x)-k*h)}
1.upto(n){|i|e=l[1..i];b=e.sum;a=[e.max*2-b,0].max;e=l[i+1..n+1];d=e.sum;c=[e.max*2-d,0].max;p f[a,c]-f[a,d]-f[b,c]+f[b,d]}
0