結果

問題 No.3022 縛りFizzBuzz (Easy)
ユーザー ant2357ant2357
提出日時 2017-03-31 22:46:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,063 bytes
コンパイル時間 1,482 ms
コンパイル使用メモリ 163,428 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 11:02:41
合計ジャッジ時間 2,370 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

int i, a, b, zero;
int main() {

	int n;
	cin >> n;

	i++;
	a++; a++; a++;
	b++; b++; b++; b++; b++;
	for (;i <= n;i++) {
		if (i % a == zero && i % b == zero) {
			cout << "FizzBuzz" << endl;
		} else if (i % a == zero) {
			cout << "Fizz" << endl;
		} else if (i % b == zero) {
			cout << "Buzz" << endl;
		} else {
			cout << i << endl;
		}
	}
}
0