結果

問題 No.593 4進FizzBuzz
ユーザー KKT89KKT89
提出日時 2020-07-14 12:09:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 1,259 ms
コンパイル使用メモリ 110,720 KB
実行使用メモリ 9,192 KB
最終ジャッジ日時 2024-04-28 13:14:25
合計ジャッジ時間 4,605 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 75 ms
7,172 KB
testcase_17 AC 100 ms
9,060 KB
testcase_18 AC 77 ms
7,176 KB
testcase_19 AC 56 ms
9,064 KB
testcase_20 AC 76 ms
7,172 KB
testcase_21 AC 77 ms
7,172 KB
testcase_22 AC 55 ms
9,192 KB
testcase_23 AC 76 ms
7,304 KB
testcase_24 AC 101 ms
9,064 KB
testcase_25 AC 99 ms
9,060 KB
testcase_26 AC 53 ms
9,188 KB
testcase_27 AC 56 ms
9,064 KB
testcase_28 AC 75 ms
7,168 KB
testcase_29 AC 56 ms
9,192 KB
testcase_30 AC 72 ms
7,296 KB
testcase_31 AC 76 ms
7,300 KB
testcase_32 AC 101 ms
9,188 KB
testcase_33 AC 54 ms
9,192 KB
testcase_34 AC 76 ms
7,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
using ull = unsigned long long;

bool check(string s,int p){
    int n=s.size();
    int res=0;
    for(int i=0;i<n;i++){
        res=(res*4+s[i]-'0')%p;
    }
    return res==0;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    if(check(s,3)||check(s,5)){
        if(check(s,3))printf("Fizz");
        if(check(s,5))printf("Buzz");
        printf("\n");
    }
    else{
        cout << s << endl;
    }
}
0