結果
| 問題 | No.593 4進FizzBuzz |
| コンテスト | |
| ユーザー |
fushime2
|
| 提出日時 | 2017-11-21 20:19:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 689 bytes |
| 記録 | |
| コンパイル時間 | 1,330 ms |
| コンパイル使用メモリ | 159,248 KB |
| 実行使用メモリ | 8,948 KB |
| 最終ジャッジ日時 | 2024-11-26 08:21:34 |
| 合計ジャッジ時間 | 3,875 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 WA * 10 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
bool f(string& s) {
ll p = 0;
for (auto&& c : s) p += c - '0';
return p % 3 == 0;
}
bool g(string& s) {
int p = 0;
rep(i, s.size()) {
int b = s[i] - '0';
p += (i&i ? b : -b);
}
return abs(p) % 11 == 0;
}
int main() {
string s;
cin >> s;
if (f(s) && g(s)) {
cout << "FizzBuzz" << endl;
}
else if (f(s)) {
cout << "Fizz" << endl;
}
else if (g(s)) {
cout << "Buzz" << endl;
}
else {
cout << s << endl;
}
return 0;
}
fushime2