結果

問題 No.593 4進FizzBuzz
ユーザー tenman
提出日時 2017-11-10 22:40:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 809 bytes
コンパイル時間 766 ms
コンパイル使用メモリ 83,512 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-24 12:56:06
合計ジャッジ時間 3,400 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 12 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N;
  cin >> N;

  string s = to_string(N);
  int n = 0;
  for (int i = 0; i < s.size(); i++) {
    n += (s[i] - '0') * pow(4, (s.size() - i - 1));
  }

  // 解答
  if (n % 15 == 0) {
    cout << "FizzBuzz" << endl;
  } else if (n % 3 == 0) {
    cout << "Fizz" << endl;
  } else if (n % 5 == 0) {
    cout << "Buzz" << endl;
  } else {
    cout << N << endl;
  }

  return 0;
}
0