結果

問題 No.454 逆2乗和
ユーザー koba-e964koba-e964
提出日時 2016-11-16 17:36:40
言語 Ruby
(3.3.0)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 188 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 11,188 KB
実行使用メモリ 16,828 KB
最終ジャッジ日時 2023-08-20 03:05:43
合計ジャッジ時間 5,939 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
16,820 KB
testcase_01 AC 116 ms
16,720 KB
testcase_02 AC 115 ms
16,632 KB
testcase_03 AC 118 ms
16,488 KB
testcase_04 AC 118 ms
16,724 KB
testcase_05 AC 115 ms
16,612 KB
testcase_06 AC 114 ms
16,824 KB
testcase_07 AC 113 ms
16,636 KB
testcase_08 AC 113 ms
16,540 KB
testcase_09 AC 109 ms
16,636 KB
testcase_10 AC 111 ms
16,792 KB
testcase_11 AC 108 ms
16,720 KB
testcase_12 AC 110 ms
16,504 KB
testcase_13 AC 112 ms
16,604 KB
testcase_14 AC 112 ms
16,736 KB
testcase_15 AC 112 ms
16,620 KB
testcase_16 AC 108 ms
16,512 KB
testcase_17 AC 110 ms
16,608 KB
testcase_18 AC 111 ms
16,608 KB
testcase_19 AC 110 ms
16,500 KB
testcase_20 AC 108 ms
16,596 KB
testcase_21 AC 112 ms
16,592 KB
testcase_22 AC 111 ms
16,772 KB
testcase_23 AC 107 ms
16,492 KB
testcase_24 AC 110 ms
16,828 KB
testcase_25 AC 113 ms
16,724 KB
testcase_26 AC 109 ms
16,724 KB
testcase_27 AC 113 ms
16,608 KB
testcase_28 AC 113 ms
16,616 KB
testcase_29 AC 111 ms
16,612 KB
testcase_30 AC 109 ms
16,544 KB
testcase_31 AC 108 ms
16,504 KB
testcase_32 AC 112 ms
16,728 KB
testcase_33 AC 110 ms
16,636 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

x = gets.to_f
n = 100000
ary = Array.new(n + 1)
for i in 1 .. n
  ary[n - i] = 1.0 / (x + i) / (x + i)
end
ary[n] = 1.0 / (x + n + 0.5)
ary.sort!
sum = 0
for a in ary
  sum += a
end
p sum
0