結果

問題 No.593 4進FizzBuzz
ユーザー take000take000
提出日時 2021-07-03 04:10:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 2,075 ms
コンパイル使用メモリ 198,624 KB
実行使用メモリ 8,528 KB
最終ジャッジ日時 2023-09-12 09:33:22
合計ジャッジ時間 6,172 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 84 ms
7,680 KB
testcase_17 AC 84 ms
7,424 KB
testcase_18 AC 84 ms
7,180 KB
testcase_19 AC 84 ms
7,340 KB
testcase_20 AC 84 ms
7,876 KB
testcase_21 AC 84 ms
7,588 KB
testcase_22 AC 84 ms
6,896 KB
testcase_23 AC 83 ms
7,372 KB
testcase_24 AC 84 ms
7,680 KB
testcase_25 AC 84 ms
7,076 KB
testcase_26 AC 84 ms
7,420 KB
testcase_27 AC 85 ms
8,460 KB
testcase_28 AC 83 ms
7,688 KB
testcase_29 AC 85 ms
7,012 KB
testcase_30 AC 84 ms
8,528 KB
testcase_31 AC 85 ms
7,480 KB
testcase_32 AC 84 ms
7,152 KB
testcase_33 AC 84 ms
7,852 KB
testcase_34 AC 84 ms
8,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;

int main() {
    string S;
    cin >> S;

    auto f = [&](int mod) -> bool {
        int cur = 0;
        for (char c : S) {
            cur = (cur * 4 + c - '0') % mod;
        }
        return cur == 0;
    };

    string ans = "";
    if (f(3)) ans += "Fizz";
    if (f(5)) ans += "Buzz";
    if (ans == "")
        cout << S;
    else
        cout << ans;
    cout << endl;

    return 0;
}
0