結果

問題 No.1185 完全な3の倍数
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-08-22 13:24:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 66,192 KB
最終ジャッジ日時 2024-04-23 07:50:35
合計ジャッジ時間 4,212 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 50 ms
64,924 KB
testcase_02 AC 47 ms
64,408 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 52 ms
63,652 KB
testcase_10 AC 53 ms
65,012 KB
testcase_11 AC 50 ms
64,988 KB
testcase_12 AC 49 ms
64,588 KB
testcase_13 AC 51 ms
65,208 KB
testcase_14 AC 54 ms
64,044 KB
testcase_15 AC 54 ms
63,880 KB
testcase_16 AC 50 ms
64,100 KB
testcase_17 AC 51 ms
64,740 KB
testcase_18 AC 52 ms
64,940 KB
testcase_19 AC 50 ms
64,672 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 50 ms
64,600 KB
testcase_24 WA -
testcase_25 AC 57 ms
64,960 KB
testcase_26 WA -
testcase_27 AC 48 ms
64,176 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 52 ms
64,780 KB
testcase_32 WA -
testcase_33 AC 56 ms
66,192 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 53 ms
64,628 KB
testcase_40 AC 54 ms
64,440 KB
testcase_41 AC 49 ms
64,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

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

"""

N = int(input())

lis = [ [0,3,6,9] ]
for i in range(7):
    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)

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)
#print (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