結果

問題 No.593 4進FizzBuzz
ユーザー ku_material_ro
提出日時 2017-12-01 17:38:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 695 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 73,092 KB
実行使用メモリ 7,312 KB
最終ジャッジ日時 2024-11-27 21:33:48
合計ジャッジ時間 3,938 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;
int kaijo(int n){
	int ans = 1;
	if (n != 0){
		for (int i = 0; i < n; i++){
			ans *= (n - i);
		}
	}
	else{
		ans = 1;
	}
	return ans;
}

int main(){
	string s;
	ll n;
	int k;
	ll a = 0;
	cin >> s;
	n = s.size();
	REP(i, n){
		k = s[i]-'0';
		a += k*pow(4, n-i-1);
	}
	//cout << a << endl;
	if (a % 3 == 0 && a % 5 == 0){
		cout << "FizzBuzz" << endl;
	}
	else if (a % 3 == 0){
		cout << "Fizz" << endl;
	}
	else if(a%5==0){
		cout << "Buzz" << endl;
	}
	else{
		cout << s << endl;
	}
	return 0;
}
0