結果

問題 No.276 連続する整数の和(1)
ユーザー urutomurutom
提出日時 2019-04-13 16:05:25
言語 Ruby
(3.1.1p18 )
結果
AC  
実行時間 268 ms / 1,000 ms
コード長 98 bytes
コンパイル時間 29 ms
使用メモリ 13,984 KB
最終ジャッジ日時 2023-02-28 07:46:03
合計ジャッジ時間 3,847 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 242 ms
13,968 KB
testcase_01 AC 245 ms
13,868 KB
testcase_02 AC 237 ms
13,864 KB
testcase_03 AC 254 ms
13,984 KB
testcase_04 AC 264 ms
13,900 KB
testcase_05 AC 266 ms
13,924 KB
testcase_06 AC 264 ms
13,864 KB
testcase_07 AC 268 ms
13,916 KB
testcase_08 AC 254 ms
13,972 KB
testcase_09 AC 249 ms
13,860 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
gcd=sum=n*(n+1)/2
1.upto(1000000){|i|
  sum+=n+i
  sum-=i
  gcd=gcd.gcd sum
}
puts gcd
0