結果

問題 No.278 連続する整数の和(2)
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2015-09-08 13:10:15
言語 Ruby
(3.3.0)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 156 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 11,288 KB
実行使用メモリ 15,540 KB
最終ジャッジ日時 2023-08-24 22:41:49
合計ジャッジ時間 2,940 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
15,320 KB
testcase_01 AC 90 ms
15,376 KB
testcase_02 AC 200 ms
15,540 KB
testcase_03 AC 90 ms
15,188 KB
testcase_04 AC 90 ms
15,340 KB
testcase_05 AC 91 ms
15,328 KB
testcase_06 AC 89 ms
15,384 KB
testcase_07 AC 89 ms
15,328 KB
testcase_08 AC 88 ms
15,288 KB
testcase_09 AC 88 ms
15,128 KB
testcase_10 AC 90 ms
15,232 KB
testcase_11 AC 101 ms
15,320 KB
testcase_12 AC 88 ms
15,336 KB
testcase_13 AC 166 ms
15,404 KB
testcase_14 AC 95 ms
15,524 KB
testcase_15 AC 130 ms
15,268 KB
testcase_16 AC 100 ms
15,400 KB
testcase_17 AC 97 ms
15,472 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'
n = gets.to_i
gcd = n.gcd(n*(n+1)/2)
puts Prime.prime_division(gcd).inject(1) {|t, (pr, r)| 
    t * (0..r).inject(0) { |s, u| s + pr**u }
}
0