結果

問題 No.487 2017 Calculation(2017の計算)
ユーザー 👑 horiesinitihoriesiniti
提出日時 2017-06-25 11:38:49
言語 Ruby
(3.2.2)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 121 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 11,220 KB
実行使用メモリ 15,300 KB
最終ジャッジ日時 2023-07-27 13:14:35
合計ジャッジ時間 2,870 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,140 KB
testcase_01 AC 83 ms
15,104 KB
testcase_02 AC 83 ms
15,156 KB
testcase_03 AC 83 ms
15,128 KB
testcase_04 AC 83 ms
15,164 KB
testcase_05 AC 83 ms
15,132 KB
testcase_06 AC 83 ms
15,188 KB
testcase_07 AC 83 ms
15,160 KB
testcase_08 AC 83 ms
15,172 KB
testcase_09 AC 82 ms
15,128 KB
testcase_10 AC 84 ms
15,032 KB
testcase_11 AC 83 ms
15,300 KB
testcase_12 AC 82 ms
15,260 KB
testcase_13 AC 84 ms
15,112 KB
testcase_14 AC 83 ms
15,144 KB
testcase_15 AC 84 ms
15,172 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

m=gets.to_i
b=(2017*2017)%m
d=1%m
c=2017
while c>0
	if c%2==1 then
		d=(d*b)%m
	end
	b=(b*b)%m
	c=c/2
end
puts (2017+d)%m
0