結果

問題 No.593 4進FizzBuzz
ユーザー かにかに
提出日時 2017-12-29 14:34:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 785 bytes
コンパイル時間 1,548 ms
コンパイル使用メモリ 165,552 KB
実行使用メモリ 8,872 KB
最終ジャッジ日時 2023-08-23 08:59:52
合計ジャッジ時間 5,304 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 48 ms
8,464 KB
testcase_17 AC 47 ms
8,128 KB
testcase_18 AC 46 ms
7,204 KB
testcase_19 AC 48 ms
6,888 KB
testcase_20 AC 46 ms
7,884 KB
testcase_21 AC 48 ms
7,032 KB
testcase_22 AC 48 ms
6,928 KB
testcase_23 AC 47 ms
7,924 KB
testcase_24 AC 46 ms
7,964 KB
testcase_25 AC 47 ms
8,504 KB
testcase_26 AC 49 ms
6,980 KB
testcase_27 AC 48 ms
6,920 KB
testcase_28 AC 47 ms
7,392 KB
testcase_29 AC 48 ms
7,128 KB
testcase_30 AC 48 ms
8,872 KB
testcase_31 AC 48 ms
7,712 KB
testcase_32 AC 47 ms
7,444 KB
testcase_33 AC 48 ms
7,576 KB
testcase_34 AC 48 ms
8,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;
unsigned long long str_to_int(std::string str) {
  unsigned long long ret;
  std::stringstream ss; ss << str;
  ss >> ret;
  return ret;
}

int main() {
  string s;
  cin >> s;
  ll s3 = 0,s5 = 0,s15 = 0,m = 1;
  rep(i,s.length()){
    s3 = (s3*4 + int(s[i]-'0')) % 3;
    s5 = (s5*4 + int(s[i]-'0')) % 5;
    s15 = (s15*4 + int(s[i]-'0')) % 15;
  }
  if(s15 == 0){
    P("FizzBuzz");
  }else if(s5 == 0){
    P("Buzz");
  }else if(s3 == 0){
    P("Fizz");
  }else{
    P(s);
  }
}
0