結果

問題 No.593 4進FizzBuzz
ユーザー TakatenTakaten
提出日時 2017-11-10 23:02:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 681 bytes
コンパイル時間 1,374 ms
コンパイル使用メモリ 165,356 KB
実行使用メモリ 8,536 KB
最終ジャッジ日時 2023-08-16 03:41:19
合計ジャッジ時間 4,260 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 42 ms
8,172 KB
testcase_17 AC 43 ms
8,536 KB
testcase_18 AC 41 ms
7,180 KB
testcase_19 AC 41 ms
8,168 KB
testcase_20 AC 40 ms
7,484 KB
testcase_21 AC 38 ms
8,152 KB
testcase_22 AC 40 ms
7,980 KB
testcase_23 AC 39 ms
7,452 KB
testcase_24 AC 42 ms
7,028 KB
testcase_25 AC 41 ms
7,480 KB
testcase_26 AC 41 ms
7,356 KB
testcase_27 AC 45 ms
7,396 KB
testcase_28 AC 40 ms
7,584 KB
testcase_29 AC 41 ms
7,640 KB
testcase_30 AC 42 ms
8,456 KB
testcase_31 AC 40 ms
8,168 KB
testcase_32 AC 40 ms
7,712 KB
testcase_33 AC 41 ms
7,620 KB
testcase_34 AC 42 ms
6,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define INF 1200000000

using namespace std;

typedef pair<int, int> P;
typedef long long int LL;

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

    int n3 = 0, n5 = 0;
    for (int i = 0; i < s.size(); i++) {
        n3 += s[i] - '0';
        n3 %= 3;
        if ((s.size() - i - 1) % 2 == 1) n5 += 4 * (s[i] - '0');
        else n5 += s[i] - '0';
        n5 %= 5;
    }

    if (n3 == 0 && n5 == 0) {
        cout << "FizzBuzz" << endl;
    } else if (n3 == 0) {
        cout << "Fizz" << endl;
    } else if (n5 == 0) {
        cout << "Buzz" << endl;
    } else {
        cout << s << endl;
    }

    return 0;
}
0