結果
| 問題 |
No.593 4進FizzBuzz
|
| コンテスト | |
| ユーザー |
peroon
|
| 提出日時 | 2019-04-22 09:50:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 863 bytes |
| コンパイル時間 | 1,812 ms |
| コンパイル使用メモリ | 167,968 KB |
| 実行使用メモリ | 7,272 KB |
| 最終ジャッジ日時 | 2024-10-09 17:18:10 |
| 合計ジャッジ時間 | 5,109 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")
ll f(string s, ll mod){
ll ans = 0;
for(char c : s){
ans *= 4;
ll v = c - '0';
ans += v;
ans %= mod;
}
return ans;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// input
string s;
cin >> s;
ll m3 = f(s, 3);
ll m5 = f(s, 5);
ll m15 = f(s, 15);
if(m15==0){
p("FizzBuzz");
}
else if(m3==0){
p("Fizz");
}
else if(m5==0){
p("Buzz");
}
else{
p(s);
}
return 0;
}
peroon