結果

問題 No.593 4進FizzBuzz
ユーザー kosakkunkosakkun
提出日時 2017-11-10 23:01:22
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 1,441 bytes
コンパイル時間 1,147 ms
コンパイル使用メモリ 110,228 KB
実行使用メモリ 8,796 KB
最終ジャッジ日時 2023-08-16 03:40:26
合計ジャッジ時間 3,815 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 41 ms
7,356 KB
testcase_17 AC 42 ms
7,736 KB
testcase_18 AC 42 ms
8,476 KB
testcase_19 AC 41 ms
7,932 KB
testcase_20 AC 42 ms
8,796 KB
testcase_21 AC 42 ms
7,476 KB
testcase_22 AC 44 ms
7,340 KB
testcase_23 AC 44 ms
7,336 KB
testcase_24 AC 41 ms
7,948 KB
testcase_25 AC 41 ms
7,932 KB
testcase_26 AC 42 ms
7,208 KB
testcase_27 AC 42 ms
7,340 KB
testcase_28 AC 44 ms
8,464 KB
testcase_29 AC 43 ms
8,732 KB
testcase_30 AC 42 ms
7,020 KB
testcase_31 AC 41 ms
7,644 KB
testcase_32 AC 43 ms
7,404 KB
testcase_33 AC 44 ms
7,612 KB
testcase_34 AC 43 ms
6,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int ask(int x, int y, int z) {
    int d;
    cout << "?" << " " << x << " " << y << " " << z << endl;
    cin >> d;
    return d;
}

void answer(int x, int y, int z) {
    cout << "!" << " " << x << " " << y << " " << z << endl;
}

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

    long long N1 = 0, N2 = 0;
    bool flag1 = false;
    bool flag2 = false;
    REP(i,S.size()) {
        N1 *= 4;
        N1 += (S[i] - '0');
        N1 %= 3;
        N2 *= 4;
        N2 += (S[i] - '0');
        N2 %= 5;
    }

    if (N1 % 3 == 0) flag1 = true;
    if (N2 % 5 == 0) flag2 = true;

    if (flag1 & flag2) {
        cout << "FizzBuzz" << endl;
    } else if (flag1) {
        cout << "Fizz" << endl;
    } else if (flag2) {
        cout << "Buzz" << endl;
    } else {
        cout << S << endl;
    }
    return 0;
}
0