結果
問題 | No.593 4進FizzBuzz |
ユーザー |
![]() |
提出日時 | 2020-12-17 18:21:12 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 547 bytes |
コンパイル時間 | 2,298 ms |
コンパイル使用メモリ | 192,396 KB |
最終ジャッジ日時 | 2025-01-17 02:27:49 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 WA * 11 |
ソースコード
#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; } 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; }