結果

問題 No.593 4進FizzBuzz
ユーザー kyo1kyo1
提出日時 2020-12-17 18:19:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 2,222 ms
コンパイル使用メモリ 202,104 KB
実行使用メモリ 5,356 KB
最終ジャッジ日時 2023-10-21 07:00:59
合計ジャッジ時間 5,729 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 9 ms
5,352 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 9 ms
5,352 KB
testcase_22 AC 11 ms
5,352 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 9 ms
5,352 KB
testcase_26 AC 11 ms
5,352 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 11 ms
5,352 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 9 ms
5,352 KB
testcase_33 AC 11 ms
5,352 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S;
  cin >> S;
  int res = 0, b = 1;
  reverse(S.begin(), S.end());
  for (int i = 0; i < (int)S.size(); i++) {
    res += (S[i] - '0') * b;
    b *= 4;
  }
  if (res % 15 == 0) {
    cout << "FizzBuzz" << '\n';
  } else if (res % 3 == 0) {
    cout << "Fizz" << '\n';
  } else if (res % 5 == 0) {
    cout << "Buzz" << '\n';
  } else {
    reverse(S.begin(), S.end());
    cout << S << '\n';
  }
  return 0;
}
0