結果

問題 No.593 4進FizzBuzz
ユーザー tnakao0123tnakao0123
提出日時 2017-11-13 09:32:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 828 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 86,336 KB
実行使用メモリ 9,012 KB
最終ジャッジ日時 2024-05-03 20:23:21
合計ジャッジ時間 3,614 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 48 ms
8,828 KB
testcase_17 AC 48 ms
7,984 KB
testcase_18 AC 48 ms
7,852 KB
testcase_19 AC 50 ms
7,752 KB
testcase_20 AC 48 ms
8,124 KB
testcase_21 AC 49 ms
9,012 KB
testcase_22 AC 49 ms
7,184 KB
testcase_23 AC 48 ms
7,988 KB
testcase_24 AC 48 ms
8,260 KB
testcase_25 AC 49 ms
8,408 KB
testcase_26 AC 49 ms
8,152 KB
testcase_27 AC 48 ms
7,188 KB
testcase_28 AC 48 ms
7,312 KB
testcase_29 AC 49 ms
7,184 KB
testcase_30 AC 48 ms
7,432 KB
testcase_31 AC 48 ms
7,188 KB
testcase_32 AC 48 ms
7,448 KB
testcase_33 AC 49 ms
7,416 KB
testcase_34 AC 48 ms
7,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 593.cc: No.593 4進FizzBuzz - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  string s;
  cin >> s;

  int m3 = 0, m5 = 0;
  for (int i = 0; i < s.size(); i++) {
    int d = s[i] - '0';
    m3 = (m3 * 4 + d) % 3;
    m5 = (m5 * 4 + d) % 5;
  }

  if (m3 == 0 && m5 == 0) puts("FizzBuzz");
  else if (m3 == 0) puts("Fizz");
  else if (m5 == 0) puts("Buzz");
  else cout << s << endl;
  return 0;
}
0