結果
| 問題 |
No.593 4進FizzBuzz
|
| コンテスト | |
| ユーザー |
e869120
|
| 提出日時 | 2017-11-10 22:26:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 511 bytes |
| コンパイル時間 | 615 ms |
| コンパイル使用メモリ | 83,860 KB |
| 実行使用メモリ | 8,648 KB |
| 最終ジャッジ日時 | 2024-11-24 12:30:14 |
| 合計ジャッジ時間 | 3,247 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<functional>
#include<map>
using namespace std;
string S, T;
int main() {
cin >> S; T = S;
reverse(S.begin(), S.end());
int c = 0, d = 1;
for (int i = 0; i < S.size(); i++) {
c += (S[i] - '0')*d; d *= 4; d %= 15; c %= 15;
}
if (c == 0)cout << "FizzBuzz" << endl;
else if (c % 3 == 0)cout << "Fizz" << endl;
else if (c % 5 == 0)cout << "Buzz" << endl;
else cout << T << endl;
return 0;
}
e869120