結果

問題 No.207 世界のなんとか
ユーザー ToasaToasa
提出日時 2018-03-08 18:35:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 749 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-15 12:17:55
合計ジャッジ時間 1,588 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,496 KB
testcase_01 AC 34 ms
10,624 KB
testcase_02 AC 38 ms
10,496 KB
testcase_03 AC 36 ms
10,752 KB
testcase_04 AC 33 ms
10,752 KB
testcase_05 AC 34 ms
10,624 KB
testcase_06 AC 34 ms
10,752 KB
testcase_07 AC 33 ms
10,752 KB
testcase_08 AC 33 ms
10,624 KB
testcase_09 AC 34 ms
10,624 KB
testcase_10 AC 33 ms
10,624 KB
testcase_11 AC 39 ms
10,752 KB
testcase_12 AC 33 ms
10,624 KB
testcase_13 AC 32 ms
10,624 KB
testcase_14 AC 33 ms
10,752 KB
testcase_15 AC 33 ms
10,624 KB
testcase_16 AC 34 ms
10,752 KB
testcase_17 AC 34 ms
10,752 KB
testcase_18 AC 34 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B = map(int, input().split())

# xの桁数取得
def digit_num(x):
    for i in range(1, 12):
        if 10**(i-1) <= x and x < 10**i:
            return i
            break

# 各位の数を取得する関数
def num_to_pieses(x):
    # xの桁数
    n = digit_num(x)
    n_box = []
    while n != 0:
        n_box.append(x // 10**(n-1))
        m = x // 10**(n-1)
        x = x - (10**(n-1) * m)
        n -= 1
    return n_box


# xを十進表記したときに、すくなくとも一つの桁に3が現れるような、xをチェックする関数
def have_3(x):
    n_box = num_to_pieses(x)
    if 3 in n_box:
        return True
    else:
        return False

for i in range(A, B+1):
    if i%3==0 or have_3(i):
        print(i)
0