結果

問題 No.593 4進FizzBuzz
ユーザー squidsquid
提出日時 2017-11-11 00:10:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 53,036 KB
実行使用メモリ 8,404 KB
最終ジャッジ日時 2023-08-16 05:50:30
合計ジャッジ時間 3,520 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 45 ms
7,708 KB
testcase_17 AC 43 ms
7,656 KB
testcase_18 AC 44 ms
8,176 KB
testcase_19 AC 44 ms
6,936 KB
testcase_20 AC 43 ms
7,996 KB
testcase_21 AC 43 ms
7,360 KB
testcase_22 AC 43 ms
7,444 KB
testcase_23 AC 44 ms
8,404 KB
testcase_24 AC 43 ms
7,948 KB
testcase_25 AC 44 ms
7,368 KB
testcase_26 AC 45 ms
6,984 KB
testcase_27 AC 45 ms
8,244 KB
testcase_28 AC 43 ms
7,980 KB
testcase_29 AC 44 ms
8,248 KB
testcase_30 AC 44 ms
7,908 KB
testcase_31 AC 43 ms
8,164 KB
testcase_32 AC 44 ms
6,864 KB
testcase_33 AC 44 ms
7,952 KB
testcase_34 AC 43 ms
7,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

string in;
long long int bit_sum=0,bit_rest_sum=0;
bool flag_fizz=false,flag_buzz=false;

int main(){
    cin>>in;

    for(int i=0; i<in.size(); i++){
        bit_sum+=in[i]-'0';
    }
    flag_fizz=bit_sum%3==0;

    for(int i=0; i<in.size(); i++){
        bit_rest_sum+=((i%2)?-1:1)*(in[i]-'0');
    }
    flag_buzz=bit_rest_sum%5==0;

    if(flag_fizz&&flag_buzz){
        cout<<"FizzBuzz"<<endl;
    }
    else if(flag_fizz){
        cout<<"Fizz"<<endl;
    }
    else if(flag_buzz){
        cout<<"Buzz"<<endl;
    }else{
        cout<<in<<endl;
    }

    return 0;
}
0