結果

問題 No.593 4進FizzBuzz
ユーザー tnakao0123tnakao0123
提出日時 2017-11-13 09:32:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 828 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 83,604 KB
実行使用メモリ 9,004 KB
最終ジャッジ日時 2023-08-16 11:56:50
合計ジャッジ時間 4,094 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 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 46 ms
7,572 KB
testcase_17 AC 46 ms
7,836 KB
testcase_18 AC 47 ms
8,120 KB
testcase_19 AC 46 ms
7,468 KB
testcase_20 AC 45 ms
7,084 KB
testcase_21 AC 45 ms
7,296 KB
testcase_22 AC 47 ms
8,260 KB
testcase_23 AC 45 ms
7,364 KB
testcase_24 AC 45 ms
7,708 KB
testcase_25 AC 46 ms
7,432 KB
testcase_26 AC 46 ms
7,216 KB
testcase_27 AC 47 ms
9,004 KB
testcase_28 AC 45 ms
7,328 KB
testcase_29 AC 48 ms
7,896 KB
testcase_30 AC 46 ms
8,272 KB
testcase_31 AC 46 ms
8,792 KB
testcase_32 AC 46 ms
7,500 KB
testcase_33 AC 47 ms
6,952 KB
testcase_34 AC 46 ms
6,936 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