結果
問題 | No.593 4進FizzBuzz |
ユーザー |
![]() |
提出日時 | 2017-11-10 22:27:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 512 bytes |
コンパイル時間 | 1,421 ms |
コンパイル使用メモリ | 168,540 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-24 12:32:00 |
合計ジャッジ時間 | 3,380 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 WA * 4 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;int main(){cin.tie(0);ios::sync_with_stdio(false);#ifdef LOCALstd::ifstream in("in");std::cin.rdbuf(in.rdbuf());#endifstring s;cin >> s;int three = 0, five = 0;for(int i = s.size() - 1; i >= 0; i--){int n = s[i];three = (three * 4 + n) % 3;five = (five * 4 + n) % 5;}string ans;if(three == 0) ans += "Fizz";if(five == 0) ans += "Buzz";if(ans.size()) cout << ans << endl;else{cout << s << endl;}}