結果

問題 No.593 4進FizzBuzz
ユーザー reitetsuoh
提出日時 2017-12-26 15:40:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 458 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 57,032 KB
実行使用メモリ 9,052 KB
最終ジャッジ日時 2024-12-18 00:19:40
合計ジャッジ時間 4,051 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

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