結果

問題 No.593 4進FizzBuzz
ユーザー ferinferin
提出日時 2017-11-10 23:09:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 1,264 bytes
コンパイル時間 2,042 ms
コンパイル使用メモリ 146,208 KB
実行使用メモリ 8,944 KB
最終ジャッジ日時 2023-08-16 04:59:07
合計ジャッジ時間 5,572 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 50 ms
8,036 KB
testcase_17 AC 51 ms
7,744 KB
testcase_18 AC 51 ms
7,332 KB
testcase_19 AC 51 ms
7,860 KB
testcase_20 AC 50 ms
8,524 KB
testcase_21 AC 50 ms
8,944 KB
testcase_22 AC 51 ms
7,756 KB
testcase_23 AC 50 ms
7,640 KB
testcase_24 AC 50 ms
8,612 KB
testcase_25 AC 50 ms
7,672 KB
testcase_26 AC 51 ms
8,200 KB
testcase_27 AC 50 ms
7,868 KB
testcase_28 AC 50 ms
7,348 KB
testcase_29 AC 51 ms
8,536 KB
testcase_30 AC 49 ms
7,208 KB
testcase_31 AC 49 ms
7,152 KB
testcase_32 AC 50 ms
7,816 KB
testcase_33 AC 51 ms
7,116 KB
testcase_34 AC 50 ms
7,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

signed main(void)
{
  string s;
  cin >> s;
  ll res = 0;
  REP(i, s.size()) {
    res += s[i] - '0';
  }
  string t = s;
  reverse(ALL(t));
  ll r = 0, a = 1;
  REP(i, t.size()) {
    r = (r+a*(t[i]-'0')) % 10;
    if(a == 1 || a == 6) a = 4;
    else a = 6;
  }

  if(res % 3 == 0 && r % 5 == 0) cout << "FizzBuzz" << endl;
  else if(r % 5 == 0) cout << "Buzz" << endl;
  else if(res % 3 == 0) cout << "Fizz" << endl;
  else cout << s << endl;

  return 0;
}
0