結果

問題 No.1235 ζ関数
ユーザー neko_the_shadowneko_the_shadow
提出日時 2020-09-21 15:24:57
言語 Ruby
(3.3.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 125 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 11,148 KB
実行使用メモリ 15,628 KB
最終ジャッジ日時 2023-09-06 17:17:11
合計ジャッジ時間 2,767 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,068 KB
testcase_01 AC 77 ms
15,512 KB
testcase_02 AC 76 ms
15,364 KB
testcase_03 AC 76 ms
15,340 KB
testcase_04 AC 76 ms
15,280 KB
testcase_05 AC 76 ms
15,296 KB
testcase_06 AC 77 ms
15,412 KB
testcase_07 AC 76 ms
15,360 KB
testcase_08 AC 77 ms
15,484 KB
testcase_09 AC 77 ms
15,492 KB
testcase_10 AC 77 ms
15,628 KB
testcase_11 AC 77 ms
15,584 KB
testcase_12 AC 76 ms
15,396 KB
testcase_13 AC 77 ms
15,328 KB
testcase_14 AC 76 ms
15,420 KB
testcase_15 AC 77 ms
15,592 KB
testcase_16 AC 76 ms
15,172 KB
testcase_17 AC 77 ms
15,340 KB
testcase_18 AC 76 ms
15,500 KB
testcase_19 AC 79 ms
15,296 KB
testcase_20 AC 77 ms
15,368 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(n)
  a = 0
  (1..).each do |i|
    b = a + 1.0 / i**n
    return b if a == b
    a = b
  end
end

n = gets.to_i
p f(n)
0