結果

問題 No.1185 完全な3の倍数
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-08-22 13:26:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 92,552 KB
最終ジャッジ日時 2023-08-15 23:57:43
合計ジャッジ時間 5,955 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
92,228 KB
testcase_01 AC 93 ms
92,252 KB
testcase_02 AC 96 ms
92,200 KB
testcase_03 AC 94 ms
92,336 KB
testcase_04 AC 93 ms
92,108 KB
testcase_05 AC 93 ms
92,328 KB
testcase_06 AC 95 ms
92,312 KB
testcase_07 AC 94 ms
92,436 KB
testcase_08 AC 93 ms
92,260 KB
testcase_09 AC 94 ms
92,492 KB
testcase_10 AC 93 ms
92,248 KB
testcase_11 AC 93 ms
92,368 KB
testcase_12 AC 92 ms
92,200 KB
testcase_13 AC 92 ms
92,032 KB
testcase_14 AC 93 ms
92,256 KB
testcase_15 AC 93 ms
92,156 KB
testcase_16 AC 93 ms
92,248 KB
testcase_17 AC 92 ms
92,280 KB
testcase_18 AC 92 ms
92,332 KB
testcase_19 AC 95 ms
92,420 KB
testcase_20 AC 94 ms
92,260 KB
testcase_21 AC 95 ms
92,264 KB
testcase_22 AC 96 ms
92,336 KB
testcase_23 AC 96 ms
92,324 KB
testcase_24 AC 94 ms
92,440 KB
testcase_25 AC 98 ms
92,356 KB
testcase_26 AC 94 ms
92,228 KB
testcase_27 AC 95 ms
92,288 KB
testcase_28 AC 96 ms
92,452 KB
testcase_29 AC 97 ms
92,108 KB
testcase_30 AC 97 ms
92,324 KB
testcase_31 AC 96 ms
92,288 KB
testcase_32 AC 94 ms
92,088 KB
testcase_33 AC 96 ms
92,112 KB
testcase_34 AC 95 ms
92,388 KB
testcase_35 AC 95 ms
92,416 KB
testcase_36 AC 96 ms
92,552 KB
testcase_37 AC 95 ms
92,412 KB
testcase_38 AC 95 ms
92,328 KB
testcase_39 AC 92 ms
92,160 KB
testcase_40 AC 91 ms
92,048 KB
testcase_41 AC 91 ms
92,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

0,3,6,9しか使えない

"""

N = int(input())

lis = [ [0,3,6,9] ]
for i in range(8):
    new = []
    for j in lis[i]:

        if j != 0:
            new.append(j * 10 + 0)
            new.append(j * 10 + 3)
            new.append(j * 10 + 6)
            new.append(j * 10 + 9)
    lis.append(new)

#print (max(lis[-1]))

new = []
for i in range(1,10):
    for j in range(10):
        if (i+j) % 3 == 0:
            new.append(i*10+j)
lis.append(new)



ans = 0
#print (lis[2])
for i in range(len(lis)):
    if i <= 1:
        continue
    for j in lis[i]:
        if 10 < j <= N:
            ans += 1
print (ans)
0