結果

問題 No.593 4進FizzBuzz
ユーザー Julius CaesarJulius Caesar
提出日時 2017-11-10 23:38:26
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 58,304 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-03 14:43:04
合計ジャッジ時間 2,493 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 9 ms
6,944 KB
testcase_17 WA -
testcase_18 AC 9 ms
6,940 KB
testcase_19 AC 10 ms
6,944 KB
testcase_20 WA -
testcase_21 AC 8 ms
6,944 KB
testcase_22 AC 10 ms
6,940 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 10 ms
6,940 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 10 ms
6,940 KB
testcase_30 AC 9 ms
6,940 KB
testcase_31 AC 9 ms
6,940 KB
testcase_32 AC 9 ms
6,944 KB
testcase_33 AC 10 ms
6,940 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);

	std::string str;
	std::cin >> str;
	
	int sum = 0, esum = 0, osum = 0;
	for(int i = 0; i < str.size(); ++i){
		int n = str[i] - '0';

		sum += n;
		if((str.size() - i) % 2 == 0){
			esum += n;
		}
		else{
			osum += n;
		}
	}

	if(sum % 3 == 0 && (esum - osum) % 11 == 0){
		std::cout << "FizzBuzz" << std::endl;
	}
	else if(sum % 3 == 0){
		std::cout << "Fizz" << std::endl;
	}
	else if((esum - osum) % 11 == 0){
		std::cout << "Buzz" << std::endl;
	}
	else{
		std::cout << str << std::endl;
	}

	return 0;
}
0