結果

問題 No.1185 完全な3の倍数
ユーザー H20
提出日時 2020-11-18 13:05:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 506 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 217,684 KB
最終ジャッジ日時 2024-07-23 09:00:49
合計ジャッジ時間 6,501 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N = int(input())
cnt = 0
T =  list(itertools.product(['0', '3', '6', '9'], repeat=len(str(N))))
for i in range(len(T)):
    num = int(''.join(T[i]))
    if num>10 and num<=N:
        cnt += 1

for i in range(10,min(100,N+1)):
    a,b = i//10 ,i%10
    if((a+b)%3==0 and a%3 != 0):
        cnt +=1

print(cnt)
0