結果
問題 | No.593 4進FizzBuzz |
ユーザー |
![]() |
提出日時 | 2017-11-10 22:35:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 518 bytes |
コンパイル時間 | 1,627 ms |
コンパイル使用メモリ | 168,048 KB |
実行使用メモリ | 5,484 KB |
最終ジャッジ日時 | 2024-11-24 12:47:57 |
合計ジャッジ時間 | 3,583 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
#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] - '0';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;}}