結果

問題 No.593 4進FizzBuzz
ユーザー newlife171128newlife171128
提出日時 2017-12-24 10:06:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 783 bytes
コンパイル時間 469 ms
コンパイル使用メモリ 66,692 KB
実行使用メモリ 8,568 KB
最終ジャッジ日時 2023-08-22 17:55:10
合計ジャッジ時間 4,414 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 87 ms
7,268 KB
testcase_17 AC 111 ms
8,568 KB
testcase_18 AC 87 ms
7,348 KB
testcase_19 AC 112 ms
8,400 KB
testcase_20 AC 63 ms
7,172 KB
testcase_21 AC 88 ms
8,392 KB
testcase_22 AC 111 ms
8,008 KB
testcase_23 AC 63 ms
7,332 KB
testcase_24 AC 111 ms
7,712 KB
testcase_25 AC 111 ms
7,100 KB
testcase_26 AC 111 ms
7,784 KB
testcase_27 AC 112 ms
7,112 KB
testcase_28 AC 63 ms
7,472 KB
testcase_29 AC 111 ms
7,196 KB
testcase_30 AC 63 ms
7,968 KB
testcase_31 AC 87 ms
7,044 KB
testcase_32 AC 112 ms
7,740 KB
testcase_33 AC 112 ms
8,072 KB
testcase_34 AC 87 ms
7,040 KB
権限があれば一括ダウンロードができます

ソースコード

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