結果

問題 No.593 4進FizzBuzz
ユーザー ku_material_roku_material_ro
提出日時 2017-12-01 17:56:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 896 bytes
コンパイル時間 1,666 ms
コンパイル使用メモリ 71,188 KB
実行使用メモリ 8,528 KB
最終ジャッジ日時 2023-08-18 15:25:46
合計ジャッジ時間 4,157 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 45 ms
7,104 KB
testcase_17 AC 45 ms
8,428 KB
testcase_18 AC 44 ms
7,132 KB
testcase_19 AC 45 ms
7,684 KB
testcase_20 AC 45 ms
7,880 KB
testcase_21 AC 46 ms
8,124 KB
testcase_22 AC 46 ms
8,528 KB
testcase_23 AC 46 ms
7,372 KB
testcase_24 AC 45 ms
7,020 KB
testcase_25 AC 44 ms
7,632 KB
testcase_26 AC 47 ms
6,940 KB
testcase_27 AC 46 ms
6,880 KB
testcase_28 AC 46 ms
7,016 KB
testcase_29 AC 45 ms
7,320 KB
testcase_30 AC 44 ms
8,156 KB
testcase_31 AC 45 ms
6,904 KB
testcase_32 AC 44 ms
7,344 KB
testcase_33 AC 46 ms
7,376 KB
testcase_34 AC 45 ms
6,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#define REP(i,n) for(ll 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;
	ll q;
	int k;
	int flag, flag3, flag5;
	int a = 0;
	int b = 0;
	cin >> s;
	//q = stoi(s);
	n = s.size();
	flag = 0;
	REP(i, n){
		k = s[n-i-1]-'0';
		a += k;
		a = a % 3;
		if (flag == 0){
			b += k;
			b = b % 5;
			flag = 1;
		}
		else{
			b += 4 * k;
			b = b % 5;
			flag = 0;
		}
	}
	//cout << a << endl;
	if (a ==0 && b == 0){
		cout << "FizzBuzz" << endl;
	}
	else if (a == 0){
		cout << "Fizz" << endl;
	}
	else if(b==0){
		cout << "Buzz" << endl;
	}
	else{
		cout << s << endl;
	}
	
	//cout << q % 3 << endl;
	return 0;
}
0