結果
問題 | No.1185 完全な3の倍数 |
ユーザー |
|
提出日時 | 2022-03-10 17:07:16 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 366 bytes |
コンパイル時間 | 387 ms |
コンパイル使用メモリ | 82,136 KB |
実行使用メモリ | 54,060 KB |
最終ジャッジ日時 | 2024-09-14 17:52:26 |
合計ジャッジ時間 | 3,290 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 26 |
ソースコード
n = int(input()) if len(str(n)) <= 2: print(n // 3 - 3) exit() ans = 30 - 15 tmp = "" cnt = 0 for i in str(n): if int(i) % 3 != 0: tmp += str(int(i) + (3 - int(i) % 3)) else: cnt += 1 tmp += i for i, j in enumerate(tmp[::-1]): ans += int(j) // 3 * (4 ** i) if cnt == len(str(n)): print(ans) else: print(ans - 1)