結果
問題 | No.593 4進FizzBuzz |
ユーザー |
|
提出日時 | 2019-01-22 12:29:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 1,664 ms |
コンパイル使用メモリ | 166,356 KB |
実行使用メモリ | 5,480 KB |
最終ジャッジ日時 | 2024-09-15 13:31:55 |
合計ジャッジ時間 | 4,528 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
#define _USE_MATH_DEFINES#include <bits/stdc++.h>using namespace std;string s;bool div(int x) {int c = 0;for (int i = 0; i < (int) s.length(); i++) {c = (c * 4 + s[i] - '0') % x;}return c == 0;}signed main() {ios::sync_with_stdio(false);cin.tie(0);cin >> s;if (div(3) && div(5)) {cout << "FizzBuzz" << endl;} else if (div(3)) {cout << "Fizz" << endl;} else if (div(5)) {cout << "Buzz" << endl;} else {cout << s << endl;}return 0;}