結果
| 問題 | No.593 4進FizzBuzz | 
| コンテスト | |
| ユーザー |  tetsuzuki1115 | 
| 提出日時 | 2018-03-19 23:55:35 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 43 ms / 2,000 ms | 
| コード長 | 702 bytes | 
| コンパイル時間 | 761 ms | 
| コンパイル使用メモリ | 84,676 KB | 
| 実行使用メモリ | 7,380 KB | 
| 最終ジャッジ日時 | 2024-06-11 21:08:19 | 
| 合計ジャッジ時間 | 4,191 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 31 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
    
    string s;
    cin >> s;
    int x,y;
    x = y = 0;
    for ( int i = 0; i < s.length(); i++ ) {
        int a = s[i]-'0';
        x += a;
        if ( i%2 ) { y += 4*a; }
        else { y += a; }
        
    }
    string ans;
    if ( x%3 == 0 ) { ans += "Fizz"; }
    if ( y%5 == 0 ) { ans += "Buzz"; }
    if ( ans.length() == 0 ) { ans = s; }
    cout << ans << endl;
    return 0;
}
            
            
            
        