結果
| 問題 | No.593 4進FizzBuzz | 
| コンテスト | |
| ユーザー |  🍮かんプリン | 
| 提出日時 | 2019-03-19 20:30:15 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 45 ms / 2,000 ms | 
| コード長 | 685 bytes | 
| コンパイル時間 | 684 ms | 
| コンパイル使用メモリ | 65,352 KB | 
| 実行使用メモリ | 8,880 KB | 
| 最終ジャッジ日時 | 2024-09-14 06:29:09 | 
| 合計ジャッジ時間 | 4,282 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge6 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 31 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
using ll = long long;
using namespace std;
const int MOD = 1e9+7;
int main() {
    string N;
    int a,b;
    a = b = 0;
    cin >> N;
    for(int i = 0; i < (int)N.length(); i++)
    {
        a += N[i] - '0';
        if (((int)N.length() - 1 - i) % 2) {
            b -= N[(int)N.length() - 1 - i] - '0';
        }
        else {
            b += N[(int)N.length() - 1 - i] - '0';
        }
    }
    if (a % 3 == 0) {
        cout << "Fizz";
    }
    if (b % 5 == 0) {
        cout << "Buzz";
    }
    if (a % 3 && b % 5) {
        cout << N;
    }
    cout << endl;
    return 0;
}
            
            
            
        