結果

問題 No.2246 1333-like Number
ユーザー Yuu EguciYuu Eguci
提出日時 2023-04-04 19:36:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 1,397 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-04-08 18:52:40
合計ジャッジ時間 3,517 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,368 KB
testcase_01 AC 32 ms
10,368 KB
testcase_02 AC 34 ms
10,368 KB
testcase_03 AC 35 ms
10,368 KB
testcase_04 AC 202 ms
10,496 KB
testcase_05 AC 102 ms
10,368 KB
testcase_06 AC 123 ms
10,368 KB
testcase_07 AC 145 ms
10,368 KB
testcase_08 AC 45 ms
10,368 KB
testcase_09 AC 107 ms
10,368 KB
testcase_10 AC 45 ms
10,368 KB
testcase_11 AC 95 ms
10,368 KB
testcase_12 AC 33 ms
10,368 KB
testcase_13 AC 39 ms
10,368 KB
testcase_14 AC 52 ms
10,368 KB
testcase_15 AC 50 ms
10,368 KB
testcase_16 AC 76 ms
10,368 KB
testcase_17 AC 140 ms
10,368 KB
testcase_18 AC 36 ms
10,368 KB
testcase_19 AC 42 ms
10,368 KB
testcase_20 AC 183 ms
10,496 KB
testcase_21 AC 121 ms
10,368 KB
testcase_22 AC 84 ms
10,368 KB
testcase_23 AC 196 ms
10,496 KB
testcase_24 AC 172 ms
10,496 KB
testcase_25 AC 30 ms
10,368 KB
testcase_26 AC 198 ms
10,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math

N = int(input())

c, remainder = divmod(N, 36)

# 36の倍数 → 商をひとつ下げる。
if remainder == 0:
    c -= 1

# NOTE: dict ではなく list にしたほうがカッコイイけど、
#       余りの値: a, b という対応にしたほうが分かりやすいと思ったので。
a, b = {
    1: (1, 2),
    2: (1, 3),
    3: (1, 4),
    4: (1, 5),
    5: (1, 6),
    6: (1, 7),
    7: (1, 8),
    8: (1, 9),
    9: (2, 3),
    10: (2, 4),
    11: (2, 5),
    12: (2, 6),
    13: (2, 7),
    14: (2, 8),
    15: (2, 9),
    16: (3, 4),
    17: (3, 5),
    18: (3, 6),
    19: (3, 7),
    20: (3, 8),
    21: (3, 9),
    22: (4, 5),
    23: (4, 6),
    24: (4, 7),
    25: (4, 8),
    26: (4, 9),
    27: (5, 6),
    28: (5, 7),
    29: (5, 8),
    30: (5, 9),
    31: (6, 7),
    32: (6, 8),
    33: (6, 9),
    34: (7, 8),
    35: (7, 9),
    0: (8, 9),
}[remainder]


def calculate_answer(a: int, b: int, c: int) -> int:
    """
    'うしっぽい数' とやらを作成する。
    """
    x = 10 * a + b
    for _ in range(c):
        x = 10 * x + b
    return x


answer = calculate_answer(a, b, c)
# 最近の Python は、4300桁以降を str 変換できない。
# 桁数を求めて……
digits = math.ceil(math.log10(answer + 1))
if digits >= 4300:
    # ……制限を変更する。
    sys.set_int_max_str_digits(digits)
print(answer)
0