結果
| 問題 |
No.593 4進FizzBuzz
|
| コンテスト | |
| ユーザー |
gotutiyan
|
| 提出日時 | 2018-05-28 09:48:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 138 ms / 2,000 ms |
| コード長 | 1,053 bytes |
| コンパイル時間 | 725 ms |
| コンパイル使用メモリ | 83,128 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-06-30 07:37:16 |
| 合計ジャッジ時間 | 4,708 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF INT_MAX
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
using namespace std;
int main(){
string s;
cin>>s;
auto solve=[&](string s,int mod){
int t=0;
rep(i,0,s.size()){
t=(t*4+s[i]-'0')%mod;
}
return t%mod==0;
};
if(!solve(s,3)&&!solve(s,5))cout<<s;
else {
if(solve(s,3))cout<<"Fizz";
if(solve(s,5))cout<<"Buzz";
}
cout<<endl;
return 0;
}
gotutiyan