結果
問題 |
No.747 循環小数N桁目 Hard
|
ユーザー |
|
提出日時 | 2024-01-14 12:36:21 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 328 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-09-28 01:58:27 |
合計ジャッジ時間 | 6,109 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 RE * 91 |
ソースコード
N=int(input()) K=int(input()) def mod_pow(x, n, mod): res = 1 while n > 0: # n=0 なら1を返す if n & 1: # i(=0,1,...)番目のビットが1なら res * x^(2^i) res = res * x % mod x = x**2 % mod # x = x^(2^(i+1)) n >>= 1 return res N%=6 ans=mod_pow(N,K,6) str="428571" print(str[ans])