結果
問題 | No.746 7の倍数 |
ユーザー |
|
提出日時 | 2022-05-16 00:33:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 398 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-13 13:00:52 |
合計ジャッジ時間 | 2,325 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
n = int(input()) if n == 0: print(0) exit() Q = [] R = [] curr = 10 nc = n while nc > 0: q, r = divmod(curr, 7) if R and R[0] == r: break Q.append(q) R.append(r) curr = r * 10 nc -= 1 if nc == 0: print("0." + ''.join(map(str, Q))) else: loop = len(Q) q, r = divmod(n, loop) print("0." + ''.join(map(str, Q)) * q + ''.join(map(str, Q[:r])))