結果

問題 No.593 4進FizzBuzz
ユーザー Julius CaesarJulius Caesar
提出日時 2017-11-10 23:24:36
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 671 bytes
コンパイル時間 1,341 ms
コンパイル使用メモリ 61,240 KB
実行使用メモリ 8,300 KB
最終ジャッジ日時 2024-11-24 15:32:33
合計ジャッジ時間 2,857 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);

	std::string str;
	std::vector<char> num;
	unsigned long long ans = 0;

	std::cin >> str;

	for(int i = 0; i < str.size(); ++i){
		num.push_back(str[i]);
	}

	unsigned long long tmp = 1;
	for(auto itr = num.rbegin(); itr != num.rend(); ++itr){
		char c = *itr;
		int n = int(c - '0');

		ans += tmp * n;
		tmp *= 4;
	}

	if(ans % 15 == 0){
		std::cout << "FizzBuzz" << std::endl;
	}
	else if(ans % 3 == 0){
		std::cout << "Fizz" << std::endl;
	}
	else if(ans % 5 == 0){
		std::cout << "Buzz" << std::endl;
	}
	else{
		std::cout << str << std::endl;
	}

	return 0;
}
0