結果
問題 |
No.1185 完全な3の倍数
|
ユーザー |
![]() |
提出日時 | 2020-09-20 20:06:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 43 ms / 2,000 ms |
コード長 | 382 bytes |
コンパイル時間 | 100 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-24 10:56:13 |
合計ジャッジ時間 | 2,656 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
ソースコード
N = int(input()) if N < 100: ans = N//3-3 else: S = str(N) c1 = 0 c2 = 0 f = True for i in range(len(S)): if i == 0: c1 = (int(S[i])-1)//3+1 else: c1 = c1*4+c2*((int(S[i])+2)//3) if int(S[i])%3 == 0 and f: c2 = 1 else: f = False c2 = 0 ans = c1+c2+14 print(ans)