結果

問題 No.593 4進FizzBuzz
ユーザー akusyounin2412akusyounin2412
提出日時 2017-11-10 23:25:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 1,363 bytes
コンパイル時間 2,586 ms
コンパイル使用メモリ 103,844 KB
実行使用メモリ 12,520 KB
最終ジャッジ日時 2023-08-16 05:27:19
合計ジャッジ時間 3,682 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,372 KB
testcase_01 AC 3 ms
7,432 KB
testcase_02 AC 3 ms
7,436 KB
testcase_03 AC 3 ms
7,376 KB
testcase_04 AC 3 ms
7,368 KB
testcase_05 AC 3 ms
7,512 KB
testcase_06 AC 3 ms
7,500 KB
testcase_07 AC 3 ms
7,376 KB
testcase_08 AC 3 ms
7,380 KB
testcase_09 AC 3 ms
7,376 KB
testcase_10 AC 3 ms
7,376 KB
testcase_11 AC 4 ms
7,484 KB
testcase_12 AC 3 ms
7,432 KB
testcase_13 AC 3 ms
7,508 KB
testcase_14 AC 3 ms
7,436 KB
testcase_15 AC 3 ms
7,428 KB
testcase_16 AC 47 ms
11,404 KB
testcase_17 AC 49 ms
11,040 KB
testcase_18 AC 46 ms
11,956 KB
testcase_19 AC 47 ms
11,972 KB
testcase_20 AC 47 ms
11,044 KB
testcase_21 AC 47 ms
11,556 KB
testcase_22 AC 46 ms
11,160 KB
testcase_23 AC 44 ms
11,580 KB
testcase_24 AC 45 ms
11,968 KB
testcase_25 AC 44 ms
11,708 KB
testcase_26 AC 45 ms
11,572 KB
testcase_27 AC 46 ms
11,480 KB
testcase_28 AC 47 ms
11,048 KB
testcase_29 AC 45 ms
11,836 KB
testcase_30 AC 45 ms
11,216 KB
testcase_31 AC 46 ms
11,504 KB
testcase_32 AC 46 ms
11,668 KB
testcase_33 AC 45 ms
11,432 KB
testcase_34 AC 44 ms
12,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
LL n, m, a[1000000] = {}, sum, ans = 0, d[1000000] = {};
bitset<10000>bi[10] = {};
struct edge { LL to, cost; };
vector<edge>vec[100000];
string st[2],str;
int main() {
	cin >> str;
	bool fb[2] = {}, FF = 1;
	for (int i = 0; i < str.size(); i++) {
		sum += str[i] - '0';
	}
	if (sum % 3 == 0)fb[0] = 1;
	LL i = 0; sum = 0;
	while (1) {
		if (i < str.size()) {
			int num = (str[i] - '0');
			sum = (sum + (FF == 1 ? num % 10 : num * 4)) % 5;
			FF = !FF;
			i++;
		}
		else break;
	}
	if (sum % 5 == 0)fb[1] = 1;
	if (fb[0] == 0 && fb[1] == 0)
		cout << str << endl;
	else
		cout << (fb[0] == 1 ? (fb[1] == 1 ? "FizzBuzz" : "Fizz") : (fb[1] == 1 ? "Buzz" : "")) << endl;
	return 0;
}
0