結果

問題 No.3022 縛りFizzBuzz (Easy)
ユーザー satanicsatanic
提出日時 2017-03-31 23:41:10
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 63,112 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-21 12:31:18
合計ジャッジ時間 1,316 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

int zero;
int one;
int three;
int five;

signed main() {
	++one;
	++three;
	++three;
	++three;
	five = three;
	++five;
	++five;
	int n;
	std::cin >> n;
	for (int i = one; i <= n; ++i) {
		if (i % three == zero && i % five == zero) {
			std::cout << "FizzBuzz";
		}
		else if (i % three == zero) {
			std::cout << "Fizz";
		}
		else if (i % five == zero) {
			std::cout << "Buzz";
		}
		else {
			std::cout << i;
		}
		std::cout << std::endl;
	}
	return zero;
}
0