結果

問題 No.1185 完全な3の倍数
ユーザー tn
提出日時 2022-03-10 15:57:09
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 497 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-09-14 16:42:31
合計ジャッジ時間 12,347 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 8 TLE * 1 -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
n = int(input())

cnt = 0

for i in range(10, min(100, n + 1)):
    cnt = cnt + 1 if (int(str(i)[0]) + int(str(i)[1])) % 3 == 0 and i % 3 == 0 else cnt
    
if n > 100:
    numList = ['0', '3', '6', '9']
    for j in range(4 ** len(str(n))):
        st = ''
        q = j
        for k in range(len(str(n))):
            st += numList[q % 4]
            q = (q - q % 4) // 4
        s = int(st)
        if s <= n and s > 100:
            cnt += 1
    
print(cnt)
0