結果

問題 No.593 4進FizzBuzz
ユーザー ohreitetsu
提出日時 2017-11-12 20:03:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 56,784 KB
実行使用メモリ 9,156 KB
最終ジャッジ日時 2024-11-24 23:17:29
合計ジャッジ時間 3,165 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
	string s;
	cin>>s;
	int sLen=s.length();
	LL v=0;
	int i;
	LL pow4=1;
	for (i=sLen-1;i>=0;i--){
		v+=(s[i]-'0')*pow4;
		pow4*=4;
	}
	if (v%3==0 && v%5!=0){
		cout<<"Fizz"<<endl;
	}else if (v%3!=0 && v%5==0){
		cout<<"Buzz"<<endl;
	}else if (v%3==0 && v%5==0){
		cout<<"FizzBuzz"<<endl;
	}else{
		cout<<s<<endl;
	}
	return 0;
}
0