結果

問題 No.593 4進FizzBuzz
ユーザー newlife171128
提出日時 2017-12-24 10:06:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 783 bytes
コンパイル時間 533 ms
コンパイル使用メモリ 66,760 KB
実行使用メモリ 8,556 KB
最終ジャッジ日時 2024-12-17 18:24:52
合計ジャッジ時間 4,031 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>

using namespace std;

int ans =0;

int get(string s, int mod){
	ans =0;
	for(int i=s.length()-1;i>=0;i--){

		if(i==0){
			ans = (ans+(s[i]-'0'))%mod;
		}else {
			ans = (ans+(s[i]-'0'))*4%mod;
		}

	}
	return ans;
}

int main() {

	string s ;
	cin>>s;

/*	int digit[s.length()];
	for(int i=0;i<s.length();i++){
		digit[i] = s[i]-'0';

	}*/

/*	for(int i=s.length()-1;i>=0;i--){

		if(i==0){
			ans = (ans+(s[i]-'0'));
		}else {
			ans = (ans+(s[i]-'0'))*4;
		}

	}*/

/*	cout<<ans;*/
	if(get(s,15) ==0){
		cout<<"FizzBuzz"<<endl;
	}else if (get(s,3) ==0) {
		cout<<"Fizz"<<endl;
	}else if (get(s,5)==0) {
		cout<<"Buzz"<<endl;
	}else {
		cout<<s<<endl;
	}
return 0;
}
0