結果

問題 No.593 4進FizzBuzz
ユーザー tubo28tubo28
提出日時 2017-11-10 22:36:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 69,596 KB
実行使用メモリ 8,556 KB
最終ジャッジ日時 2024-05-03 12:50:30
合計ジャッジ時間 2,798 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 41 ms
7,576 KB
testcase_17 AC 40 ms
8,164 KB
testcase_18 AC 44 ms
8,416 KB
testcase_19 AC 41 ms
8,052 KB
testcase_20 AC 42 ms
7,312 KB
testcase_21 AC 41 ms
7,740 KB
testcase_22 AC 41 ms
8,216 KB
testcase_23 AC 42 ms
8,288 KB
testcase_24 AC 43 ms
7,188 KB
testcase_25 AC 41 ms
7,532 KB
testcase_26 AC 41 ms
7,640 KB
testcase_27 AC 40 ms
7,972 KB
testcase_28 AC 43 ms
7,792 KB
testcase_29 AC 42 ms
8,556 KB
testcase_30 AC 45 ms
8,472 KB
testcase_31 AC 41 ms
7,916 KB
testcase_32 AC 40 ms
7,804 KB
testcase_33 AC 41 ms
7,632 KB
testcase_34 AC 43 ms
7,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <stack>
#include <vector>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int t = 0, f = 0;
    for (int i = 0; i < s.size(); ++i)
    {
        const int x = s[i] - '0';
        t += x;
        f += i & 1 ? x : -x;
    }
    t %= 3;
    f %= 5;
    if (t == 0 || f == 0)
    {
        if (t == 0) cout << "Fizz";
        if (f == 0) cout << "Buzz";
    } 
    else
    {
        cout << s;
    }
    cout << endl;
}
0