結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll N, N4;
  cin >> N;

  N4 = N;
  
  ll N10 = 0;
  ll p = 1;
  while(N4>0){
    N10 += p * (N4%10);
    p *= 4;
    N4 /= 10;
  }
  
  string ret = "";
  if(N10%3 == 0){
    ret += "Fizz";
  }
  if(N10%5 == 0){
    ret += "Buzz";
  }

  if(ret == ""){
    cout << N << endl;
  }else{
    cout << ret << endl;
  }
  
  return 0;
}
0