結果

問題 No.593 4進FizzBuzz
ユーザー 👑 yumechiyumechi
提出日時 2017-11-24 22:24:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 84,152 KB
最終ジャッジ日時 2023-08-18 04:41:41
合計ジャッジ時間 6,441 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,004 KB
testcase_01 AC 73 ms
71,440 KB
testcase_02 AC 72 ms
71,356 KB
testcase_03 AC 74 ms
71,192 KB
testcase_04 AC 72 ms
71,000 KB
testcase_05 AC 72 ms
71,484 KB
testcase_06 AC 72 ms
71,356 KB
testcase_07 AC 75 ms
71,196 KB
testcase_08 AC 75 ms
71,444 KB
testcase_09 AC 74 ms
71,480 KB
testcase_10 AC 74 ms
71,164 KB
testcase_11 AC 74 ms
71,392 KB
testcase_12 AC 73 ms
71,444 KB
testcase_13 AC 72 ms
71,356 KB
testcase_14 AC 73 ms
71,240 KB
testcase_15 AC 72 ms
71,004 KB
testcase_16 AC 141 ms
83,988 KB
testcase_17 AC 140 ms
84,096 KB
testcase_18 AC 141 ms
83,980 KB
testcase_19 AC 142 ms
83,960 KB
testcase_20 AC 141 ms
83,944 KB
testcase_21 AC 140 ms
83,960 KB
testcase_22 AC 144 ms
83,872 KB
testcase_23 AC 139 ms
84,044 KB
testcase_24 AC 141 ms
83,920 KB
testcase_25 AC 141 ms
83,976 KB
testcase_26 AC 141 ms
83,820 KB
testcase_27 AC 142 ms
83,920 KB
testcase_28 AC 145 ms
84,056 KB
testcase_29 AC 149 ms
83,780 KB
testcase_30 AC 146 ms
83,784 KB
testcase_31 AC 146 ms
84,152 KB
testcase_32 AC 146 ms
84,140 KB
testcase_33 AC 143 ms
83,976 KB
testcase_34 AC 139 ms
84,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = input()
    if len(n) == 1:
        print(n if n != "3" else "Fizz")
        return

    i3, i5, t = 0, 0, 0
    for i, v in enumerate(n[::-1]):
        tv = int(v)
        i3 += tv
        if i == 0:
            t = tv * 1
        else: 
            t = tv * [4, 6][(i + 1) % 2]
        t %= 10
        i5 += t
        i3, i5 = i3 % 3, i5 % 5
    print(((i3 == 0 and "Fizz" or "") + (i5 == 0 and "Buzz" or "")) or n)

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