結果

問題 No.593 4進FizzBuzz
ユーザー square1001square1001
提出日時 2017-11-10 22:26:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 648 ms
コンパイル使用メモリ 74,308 KB
実行使用メモリ 8,708 KB
最終ジャッジ日時 2024-11-24 12:31:34
合計ジャッジ時間 3,287 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string s;
int main() {
	cin >> s;
	int res = 0;
	for (int i = 0; i < s.size(); i++) {
		res = res * 4 + (s[i] - 48);
		res %= 15;
	}
	if (res % 15 == 0) cout << "FizzBuzz" << endl;
	else if (res % 3 == 0) cout << "Fizz" << endl;
	else if (res % 5 == 0) cout << "Buzz" << endl;
	else cout << s << endl;
	return 0;
}
0