結果

問題 No.593 4進FizzBuzz
ユーザー 👑 yumechiyumechi
提出日時 2017-11-24 22:02:51
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,268 bytes
コンパイル時間 1,641 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 92,200 KB
最終ジャッジ日時 2023-08-18 04:30:12
合計ジャッジ時間 8,058 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
75,968 KB
testcase_01 AC 91 ms
71,304 KB
testcase_02 AC 86 ms
71,352 KB
testcase_03 AC 93 ms
71,544 KB
testcase_04 AC 90 ms
71,348 KB
testcase_05 AC 89 ms
71,436 KB
testcase_06 AC 84 ms
71,528 KB
testcase_07 AC 82 ms
71,536 KB
testcase_08 AC 88 ms
71,360 KB
testcase_09 AC 125 ms
71,536 KB
testcase_10 AC 82 ms
71,076 KB
testcase_11 AC 92 ms
71,328 KB
testcase_12 AC 93 ms
71,452 KB
testcase_13 AC 94 ms
71,336 KB
testcase_14 AC 93 ms
71,272 KB
testcase_15 AC 94 ms
71,156 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# please use positive value


def convert10toDecimal(
    num,  # expected Integer type
    decimal,  # expected Integer type
    characters="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",  # expected upper case
    lowercharacter=False
):

    # decimal only can use 2 to 36
    if num < 0 and not 2 <= decimal <= len(characters):
        return None

    convertedValue = ""
    while num > 0:
        convertedValue = \
            characters[num % decimal] + convertedValue
        num //= decimal
    return convertedValue

# please use positive value


def convertDecimalto10(
    numstr,  # expected String type
    decimal,  # expected String type
    characters="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"  # expected upper case
):

    # decimal only can use 2 to 36
    if not 2 <= decimal <= len(characters):
        return None

    numstr = numstr.upper()  # use characters upper case
    powercnt = 1
    decimal10value = 0
    for chara in numstr[::-1]:
        decimal10value += powercnt * characters.index(chara)
        powercnt *= decimal

    return decimal10value


def run():
    n = input()
    r = convertDecimalto10(numstr=n, decimal=4)
    print(((r % 3 == 0 and "Fizz" or  "") + (r % 5 == 0 and "Buzz" or "")) or n)

if __name__ == "__main__":
    run()
0