結果

問題 No.1185 完全な3の倍数
コンテスト
ユーザー boutarou
提出日時 2020-08-24 07:40:47
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 394 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 626 ms
コンパイル使用メモリ 20,668 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-05-06 05:29:51
合計ジャッジ時間 10,800 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

s = input()

n = int(s)
num = len(s)

ans = 0

for i in range(4 ** num):
    now = i
    cnt = 0
    for j in range(num):
        cnt *= 10
        cnt += (now % 4) * 3
        now //= 4
    if (cnt <= n):
        ans += 1

for i in range(10, min(100, n + 1)):
    a = i % 10
    b = i // 10
    if ((a % 3 == 1 and b % 3 == 2) or (a % 3 == 2 and b % 3 == 1)):
        ans += 1

print(ans - 4)
0