結果
| 問題 | No.593 4進FizzBuzz |
| コンテスト | |
| ユーザー |
kyo1
|
| 提出日時 | 2020-12-17 18:21:43 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 560 bytes |
| 記録 | |
| コンパイル時間 | 2,176 ms |
| コンパイル使用メモリ | 210,840 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-16 01:31:34 |
| 合計ジャッジ時間 | 5,091 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string S;
cin >> S;
int res = 0, b = 1;
reverse(S.begin(), S.end());
for (int i = 0; i < (int)S.size(); i++) {
res += (S[i] - '0') * b;
res %= 15;
b *= 4;
b %= 15;
}
if (res % 15 == 0) {
cout << "FizzBuzz" << '\n';
} else if (res % 3 == 0) {
cout << "Fizz" << '\n';
} else if (res % 5 == 0) {
cout << "Buzz" << '\n';
} else {
reverse(S.begin(), S.end());
cout << S << '\n';
}
return 0;
}
kyo1