結果
問題 | No.593 4進FizzBuzz |
ユーザー | tubo28 |
提出日時 | 2017-11-10 22:36:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 619 ms |
コンパイル使用メモリ | 69,504 KB |
実行使用メモリ | 7,312 KB |
最終ジャッジ日時 | 2024-11-24 12:49:23 |
合計ジャッジ時間 | 3,066 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
#include <iostream> #include <cstdio> #include <string> #include <stack> #include <vector> using namespace std; int main() { string s; cin >> s; int t = 0, f = 0; for (int i = 0; i < s.size(); ++i) { const int x = s[i] - '0'; t += x; f += i & 1 ? x : -x; } t %= 3; f %= 5; if (t == 0 || f == 0) { if (t == 0) cout << "Fizz"; if (f == 0) cout << "Buzz"; } else { cout << s; } cout << endl; }