結果

問題 No.593 4進FizzBuzz
ユーザー treeone
提出日時 2017-06-15 00:12:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 1,172 ms
コンパイル使用メモリ 159,600 KB
実行使用メモリ 9,300 KB
最終ジャッジ日時 2024-10-14 13:40:27
合計ジャッジ時間 4,246 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 12
権限があれば一括ダウンロードができます

ソースコード

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