結果

問題 No.593 4進FizzBuzz
ユーザー tkmst201tkmst201
提出日時 2021-01-23 14:45:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 893 bytes
コンパイル時間 3,151 ms
コンパイル使用メモリ 198,312 KB
実行使用メモリ 8,532 KB
最終ジャッジ日時 2023-08-29 01:41:01
合計ジャッジ時間 6,420 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 46 ms
7,184 KB
testcase_17 AC 46 ms
8,532 KB
testcase_18 AC 46 ms
7,420 KB
testcase_19 AC 47 ms
7,632 KB
testcase_20 AC 45 ms
7,144 KB
testcase_21 AC 46 ms
7,224 KB
testcase_22 AC 46 ms
7,608 KB
testcase_23 AC 46 ms
6,900 KB
testcase_24 AC 45 ms
7,372 KB
testcase_25 AC 46 ms
6,948 KB
testcase_26 AC 47 ms
7,676 KB
testcase_27 AC 47 ms
7,188 KB
testcase_28 AC 45 ms
7,468 KB
testcase_29 AC 46 ms
7,416 KB
testcase_30 AC 46 ms
8,208 KB
testcase_31 AC 45 ms
8,000 KB
testcase_32 AC 46 ms
7,364 KB
testcase_33 AC 47 ms
6,960 KB
testcase_34 AC 45 ms
7,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = false;
//---------------------------------//

int main() {
	string N;
	cin >> N;
	int p3 = 0, p5 = 0;
	REP(i, N.size()) {
		int c = N[i] - '0';
		p3 = (p3 * 4 + c) % 3;
		p5 = (p5 * 4 + c) % 5;
	}
	if (p3 == 0 && p5 == 0) puts("FizzBuzz");
	else if (p3 == 0) puts("Fizz");
	else if (p5 == 0) puts("Buzz");
	else cout << N << endl;
}
0