結果

問題 No.593 4進FizzBuzz
ユーザー treeonetreeone
提出日時 2017-06-14 23:52:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 1,798 ms
コンパイル使用メモリ 145,724 KB
実行使用メモリ 10,416 KB
最終ジャッジ日時 2023-08-04 16:28:27
合計ジャッジ時間 4,292 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 43 ms
7,064 KB
testcase_17 AC 42 ms
7,304 KB
testcase_18 AC 42 ms
7,692 KB
testcase_19 AC 45 ms
8,940 KB
testcase_20 AC 42 ms
7,420 KB
testcase_21 AC 42 ms
7,648 KB
testcase_22 AC 44 ms
8,920 KB
testcase_23 AC 43 ms
7,816 KB
testcase_24 AC 43 ms
8,536 KB
testcase_25 AC 43 ms
8,636 KB
testcase_26 AC 45 ms
10,304 KB
testcase_27 AC 45 ms
9,196 KB
testcase_28 AC 43 ms
7,068 KB
testcase_29 AC 45 ms
10,416 KB
testcase_30 AC 42 ms
7,600 KB
testcase_31 AC 43 ms
8,460 KB
testcase_32 AC 42 ms
7,124 KB
testcase_33 AC 45 ms
9,144 KB
testcase_34 AC 42 ms
8,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

string solve(string s){
    int sum[2] = {};
    string res = "";
    for(int i = 0; i < s.size(); i++){
        sum[i % 2] += s[i] - '0';
    }
    if((sum[0] + sum[1]) % 3 == 0){
        res += "Fizz";
    }
    if((sum[0] - sum[1]) % 5 == 0){
        res += "Buzz";
    }
    if(res == ""){
        res = s;
    }
    return res;
}

signed main(){
    string s;
    cin >> s;
    cout << solve(s) << endl;
}
0