結果

問題 No.593 4進FizzBuzz
ユーザー newlife171128newlife171128
提出日時 2017-12-24 08:56:26
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 650 bytes
コンパイル時間 659 ms
コンパイル使用メモリ 67,284 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-17 18:20:06
合計ジャッジ時間 4,915 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 12 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>

using namespace std;

int main() {

	long num =0;
	cin>>num;

	stringstream ss;
	ss<<num;

	string s = ss.str();

	int digit[s.length()];
	int tmp =num;
	for(int i=0;i<s.length();i++){
		digit[i] = tmp%10;
		tmp /=10;
	}

	int ans =0;
	for(int i=s.length()-1;i>=0;i--){

		if(i==0){
			ans = (ans+digit[i]);
		}else {
			ans = (ans+digit[i])*4;
		}

	}

	if(ans %15 ==0){
		cout<<"FizzBuzz"<<endl;
	}else if (ans %3 ==0) {
		cout<<"Fizz"<<endl;
	}else if (ans % 5==0) {
		cout<<"Buzz"<<endl;
	}else {
		cout<<num<<endl;
	}
return 0;
}

0