結果

問題 No.593 4進FizzBuzz
ユーザー ThetaTheta
提出日時 2022-10-19 18:07:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 613 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 34,504 KB
最終ジャッジ日時 2023-09-12 07:04:54
合計ジャッジ時間 16,030 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
9,216 KB
testcase_01 AC 26 ms
9,240 KB
testcase_02 AC 25 ms
9,288 KB
testcase_03 AC 25 ms
9,176 KB
testcase_04 AC 25 ms
9,180 KB
testcase_05 AC 25 ms
9,184 KB
testcase_06 AC 25 ms
9,220 KB
testcase_07 AC 26 ms
9,184 KB
testcase_08 AC 26 ms
9,088 KB
testcase_09 AC 25 ms
9,084 KB
testcase_10 AC 24 ms
9,184 KB
testcase_11 AC 24 ms
9,100 KB
testcase_12 AC 25 ms
9,164 KB
testcase_13 AC 25 ms
9,236 KB
testcase_14 AC 25 ms
9,156 KB
testcase_15 AC 25 ms
9,100 KB
testcase_16 AC 609 ms
34,320 KB
testcase_17 AC 609 ms
34,348 KB
testcase_18 AC 607 ms
34,344 KB
testcase_19 AC 606 ms
34,408 KB
testcase_20 AC 609 ms
34,248 KB
testcase_21 AC 606 ms
34,448 KB
testcase_22 AC 613 ms
34,336 KB
testcase_23 AC 607 ms
34,456 KB
testcase_24 AC 612 ms
34,460 KB
testcase_25 AC 606 ms
34,268 KB
testcase_26 AC 610 ms
34,356 KB
testcase_27 AC 609 ms
34,380 KB
testcase_28 AC 608 ms
34,376 KB
testcase_29 AC 608 ms
34,392 KB
testcase_30 AC 612 ms
34,492 KB
testcase_31 AC 605 ms
34,440 KB
testcase_32 AC 609 ms
34,340 KB
testcase_33 AC 600 ms
34,256 KB
testcase_34 AC 598 ms
34,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from re import X


def is_5_divisor_base_4(num_base4: str) -> bool:
    odd_sum = sum(map(int, list(num_base4)[::2]))
    even_sum = sum(map(int, list(num_base4)[1::2]))
    return (odd_sum - even_sum) % 5 == 0


def is_3_divisor_base_4(num_base4: str) -> bool:
    return sum(map(int, list(num_base4))) % 3 == 0


def main():
    N = input()
    printed = False
    if is_3_divisor_base_4(N):
        print("Fizz", end="")
        printed = True
    if is_5_divisor_base_4(N):
        print("Buzz", end="")
        printed = True

    if not printed:
        print(N, end="")
    print()


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