結果
| 問題 |
No.747 循環小数N桁目 Hard
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-14 12:36:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 328 bytes |
| コンパイル時間 | 382 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 65,408 KB |
| 最終ジャッジ日時 | 2024-09-28 01:58:39 |
| 合計ジャッジ時間 | 11,391 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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])