結果
| 問題 | No.593 4進FizzBuzz | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-05-20 14:52:39 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 53 ms / 2,000 ms | 
| コード長 | 404 bytes | 
| コンパイル時間 | 566 ms | 
| コンパイル使用メモリ | 64,512 KB | 
| 実行使用メモリ | 7,312 KB | 
| 最終ジャッジ日時 | 2024-06-28 14:40:52 | 
| 合計ジャッジ時間 | 4,090 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 31 | 
ソースコード
#include<iostream>
using namespace std;
int main(){
    string s;
    cin >> s;
    int three = 0;
    int five = 0;
    for(int i = 0; i < s.size(); i++){
        int x = s[i] - '0';
        three = (three*4 + x)%3;
        five = (five*4 + x)%5;
    }
    if(three==0)    cout << "Fizz";
    if(five==0)     cout << "Buzz";
    if(three!=0 && five!=0) cout << s;
    cout << endl;
    return 0;
}
            
            
            
        