結果

問題 No.593 4進FizzBuzz
ユーザー jimmyo0705jimmyo0705
提出日時 2017-11-10 22:34:29
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,264 bytes
コンパイル時間 594 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 9,168 KB
最終ジャッジ日時 2024-11-24 12:45:45
合計ジャッジ時間 3,403 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

string s;

int calc(string s) {
	int res = 0;
	reverse(ALL(s));
	int cnt = 1;
	rep(i, s.size()) {
		res += cnt*(s[i] - '0');
		cnt *= 4;
	}
	return res;
}

int main() {
	cin >> s;
	int num = calc(s);
	if (num % 3 == 0) {
		if (num % 5 == 0)cout << "FizzBuzz" << endl;
		else cout << "Fizz" << endl;
	}
	else if (num % 5 == 0) cout << "Buzz" << endl;
	else cout << s << endl;
}
0