結果
問題 | No.593 4進FizzBuzz |
ユーザー |
![]() |
提出日時 | 2017-11-10 23:01:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 1,441 bytes |
コンパイル時間 | 1,175 ms |
コンパイル使用メモリ | 111,744 KB |
実行使用メモリ | 7,316 KB |
最終ジャッジ日時 | 2024-11-24 13:20:19 |
合計ジャッジ時間 | 3,966 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
#include <iostream> #include <fstream> #include <sstream> #include <vector> #include <string> #include <algorithm> #include <queue> #include <stack> #include <map> #include <set> #include <unordered_set> #include <unordered_map> #include <bitset> #include <limits> #include <random> #include <complex> #include <cmath> #include <cstdio> #include <cstdlib> #include <string.h> #include <iomanip> using namespace std; #define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--) #define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end()) typedef long long ll; int ask(int x, int y, int z) { int d; cout << "?" << " " << x << " " << y << " " << z << endl; cin >> d; return d; } void answer(int x, int y, int z) { cout << "!" << " " << x << " " << y << " " << z << endl; } int main(void) { string S; cin >> S; long long N1 = 0, N2 = 0; bool flag1 = false; bool flag2 = false; REP(i,S.size()) { N1 *= 4; N1 += (S[i] - '0'); N1 %= 3; N2 *= 4; N2 += (S[i] - '0'); N2 %= 5; } if (N1 % 3 == 0) flag1 = true; if (N2 % 5 == 0) flag2 = true; if (flag1 & flag2) { cout << "FizzBuzz" << endl; } else if (flag1) { cout << "Fizz" << endl; } else if (flag2) { cout << "Buzz" << endl; } else { cout << S << endl; } return 0; }