結果
| 問題 | No.593 4進FizzBuzz |
| コンテスト | |
| ユーザー |
misora192
|
| 提出日時 | 2020-06-08 09:23:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 754 bytes |
| 記録 | |
| コンパイル時間 | 1,761 ms |
| コンパイル使用メモリ | 167,332 KB |
| 実行使用メモリ | 7,272 KB |
| 最終ジャッジ日時 | 2024-12-24 14:26:42 |
| 合計ジャッジ時間 | 5,301 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int mymod(string s, int m){
int ret = 0;
for(char c : s){
ret *= 4;
ret += c - '0';
ret %= m;
}
return ret;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin >> s;
int m3 = mymod(s, 3);
int m5 = mymod(s, 5);
if(m3 == 0 && m5 == 0){
cout << "FizzBuzz" << endl;
}else if(m3 == 0){
cout << "Fizz" << endl;
}else if(m5 == 0){
cout << "Buzz" << endl;
}else{
cout << s << endl;
}
}
misora192