結果

問題 No.251 大きな桁の復習問題(1)
ユーザー finefine
提出日時 2016-04-04 22:55:17
言語 Ruby
(3.3.0)
結果
AC  
実行時間 166 ms / 5,000 ms
コード長 171 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 11,264 KB
実行使用メモリ 16,400 KB
最終ジャッジ日時 2023-08-27 01:36:34
合計ジャッジ時間 4,298 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
14,992 KB
testcase_01 AC 79 ms
15,064 KB
testcase_02 AC 71 ms
15,184 KB
testcase_03 AC 72 ms
14,996 KB
testcase_04 AC 72 ms
15,108 KB
testcase_05 AC 72 ms
15,056 KB
testcase_06 AC 76 ms
15,176 KB
testcase_07 AC 72 ms
15,180 KB
testcase_08 AC 74 ms
15,028 KB
testcase_09 AC 166 ms
16,240 KB
testcase_10 AC 159 ms
16,328 KB
testcase_11 AC 154 ms
16,188 KB
testcase_12 AC 159 ms
16,172 KB
testcase_13 AC 154 ms
16,284 KB
testcase_14 AC 156 ms
16,240 KB
testcase_15 AC 166 ms
16,184 KB
testcase_16 AC 157 ms
16,384 KB
testcase_17 AC 156 ms
16,156 KB
testcase_18 AC 158 ms
16,400 KB
testcase_19 AC 155 ms
16,284 KB
testcase_20 AC 71 ms
15,092 KB
testcase_21 AC 73 ms
15,244 KB
testcase_22 AC 73 ms
15,048 KB
testcase_23 AC 71 ms
15,096 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

MOD = 129402307
n = gets.to_i % MOD
m = gets.to_i
ans = 1
m.to_s(2).size.times{|i|
    if m[i] == 1
        ans = (ans * n) % MOD
    end
    n = (n * n) % MOD
    }
p ans
0