結果

問題 No.593 4進FizzBuzz
ユーザー treeonetreeone
提出日時 2017-06-15 00:12:18
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 1,941 ms
コンパイル使用メモリ 160,248 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-22 14:34:16
合計ジャッジ時間 4,549 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 46 ms
9,044 KB
testcase_19 AC 47 ms
9,112 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 47 ms
9,040 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 47 ms
9,164 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 47 ms
9,036 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 45 ms
9,164 KB
testcase_33 AC 48 ms
9,112 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int change_to_10(string s){
    int k = 0;
    for(int i = 0; i < s.size(); i++){
        k = k * 4 + (s[i] - '0');
    }
    return k;
}

string solve2(string s){
    int n = change_to_10(s);
    string res = "";
    if(n % 3 == 0) res += "Fizz";
    if(n % 5 == 0) res += "Buzz";
    if(res == "") res = s;
    return res;
}

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