結果
問題 | No.593 4進FizzBuzz |
ユーザー | okayunonaha |
提出日時 | 2017-11-10 23:45:50 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 1,195 bytes |
コンパイル時間 | 1,730 ms |
コンパイル使用メモリ | 165,824 KB |
実行使用メモリ | 8,520 KB |
最終ジャッジ日時 | 2023-08-16 05:40:04 |
合計ジャッジ時間 | 4,529 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,384 KB |
testcase_11 | AC | 2 ms
4,376 KB |
testcase_12 | AC | 1 ms
4,380 KB |
testcase_13 | AC | 2 ms
4,380 KB |
testcase_14 | AC | 2 ms
4,376 KB |
testcase_15 | AC | 2 ms
4,376 KB |
testcase_16 | AC | 45 ms
7,324 KB |
testcase_17 | AC | 45 ms
7,728 KB |
testcase_18 | AC | 44 ms
7,104 KB |
testcase_19 | AC | 46 ms
7,168 KB |
testcase_20 | AC | 45 ms
8,188 KB |
testcase_21 | AC | 45 ms
7,884 KB |
testcase_22 | AC | 46 ms
8,520 KB |
testcase_23 | AC | 45 ms
7,332 KB |
testcase_24 | AC | 45 ms
7,932 KB |
testcase_25 | AC | 45 ms
7,176 KB |
testcase_26 | AC | 45 ms
7,524 KB |
testcase_27 | AC | 46 ms
7,016 KB |
testcase_28 | AC | 45 ms
7,340 KB |
testcase_29 | AC | 45 ms
7,100 KB |
testcase_30 | AC | 44 ms
7,452 KB |
testcase_31 | AC | 45 ms
7,320 KB |
testcase_32 | AC | 45 ms
7,600 KB |
testcase_33 | AC | 46 ms
7,176 KB |
testcase_34 | AC | 45 ms
7,512 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; //typedef long long ll; #define INF (1LL << 31 - 1) #define INFLL ((1LL << 62) - 1) #define MOD int(1e9+7) #define repi(i,j,n) for(int i = (j); i < (n); ++i) #define rep(i,n) repi(i,0,n) #define rrep(i,n) for (int i = n; i >= 0; --i) #define fi first #define se second #define all(v) (v).begin(), (v).end() int vx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, vy[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; inline bool check(int ux, int uy, int x, int y) { return (0 <= x and x < ux and 0 <= y and y < uy); } inline void init() { cin.tie(0); ios::sync_with_stdio(false); } ll three, five; string n; int main() { cin >> n; string s = n; int _size = s.size(); reverse(s.begin(), s.end()); rep(i,_size) { three += int(s[i] - '0'); if (i == 0) { five += int(s[i] - '0'); } else if (i % 2 == 1) { five += 4 * int(s[i] - '0'); } else five += 6 * int(s[i] - '0'); } if (three % 3 == 0 and five % 5 == 0) { cout << "FizzBuzz\n"; } else if (three % 3 == 0) { cout << "Fizz\n"; } else if (five % 5 == 0) { cout << "Buzz\n"; } else cout << n << "\n"; return 0; }