結果

問題 No.593 4進FizzBuzz
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-11-10 23:02:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 1,538 bytes
コンパイル時間 1,337 ms
コンパイル使用メモリ 165,376 KB
実行使用メモリ 5,200 KB
最終ジャッジ日時 2023-08-16 03:41:27
合計ジャッジ時間 3,876 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 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 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 23 ms
5,172 KB
testcase_17 AC 30 ms
5,108 KB
testcase_18 AC 23 ms
5,200 KB
testcase_19 AC 31 ms
5,052 KB
testcase_20 AC 16 ms
5,068 KB
testcase_21 AC 23 ms
5,072 KB
testcase_22 AC 31 ms
5,080 KB
testcase_23 AC 15 ms
5,060 KB
testcase_24 AC 30 ms
5,084 KB
testcase_25 AC 31 ms
5,200 KB
testcase_26 AC 32 ms
5,176 KB
testcase_27 AC 31 ms
5,112 KB
testcase_28 AC 16 ms
5,088 KB
testcase_29 AC 33 ms
5,076 KB
testcase_30 AC 15 ms
5,080 KB
testcase_31 AC 25 ms
5,076 KB
testcase_32 AC 33 ms
5,084 KB
testcase_33 AC 33 ms
5,108 KB
testcase_34 AC 24 ms
5,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/




string N;
//---------------------------------------------------------------------------------------------------
int get(int mod) {
    int x = 1;

    int res = 0;
    int n = N.length();
    rrep(i, n - 1, 0) {
        res = (res + (N[i] - '0') * x) % mod;
        x = (x * 4) % mod;
    }
    return res;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    if (get(15) == 0) printf("FizzBuzz\n");
    else if (get(3) == 0) printf("Fizz\n");
    else if (get(5) == 0) printf("Buzz\n");
    else printf("%s\n", N.c_str());
}
0