結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
15,336 KB
testcase_01 AC 93 ms
15,120 KB
testcase_02 AC 200 ms
15,524 KB
testcase_03 AC 90 ms
15,340 KB
testcase_04 AC 88 ms
15,168 KB
testcase_05 AC 89 ms
15,248 KB
testcase_06 AC 89 ms
15,364 KB
testcase_07 AC 88 ms
15,276 KB
testcase_08 AC 89 ms
15,244 KB
testcase_09 AC 88 ms
15,132 KB
testcase_10 AC 89 ms
15,096 KB
testcase_11 AC 99 ms
15,288 KB
testcase_12 AC 88 ms
15,296 KB
testcase_13 AC 162 ms
15,544 KB
testcase_14 AC 96 ms
15,492 KB
testcase_15 AC 130 ms
15,464 KB
testcase_16 AC 99 ms
15,520 KB
testcase_17 AC 96 ms
15,468 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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