結果

問題 No.311 z in FizzBuzzString
ユーザー kurokojikurokoji
提出日時 2016-05-13 09:53:02
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,330 bytes
コンパイル時間 1,240 ms
コンパイル使用メモリ 160,492 KB
実行使用メモリ 814,732 KB
最終ジャッジ日時 2023-10-25 02:43:50
合計ジャッジ時間 3,849 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 MLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
inline bool inside(int y, int x, int H, int W) {return (y >= 0 && x >= 0 && y < H && x < W);}

/* }}} */

signed main()
{
  ios::sync_with_stdio(false);
  string s;
  int n;

  cin >> n;
  RREP(i, n){
    if (i % 15 == 0){
      s += "FizzBuzz";
    } else if (i % 3 == 0){
      s += "Fizz";
    } else if (i % 5 == 0){
      s += "Buzz";
    } else {
      s += 1 + '0';
    }
  }

  int cnt = 0;
  REP(i, s.size()){
    if (s[i] == 'z'){
      cnt++;
    }
  }
  print(cnt);

  return (0);
}
0