結果

問題 No.3022 縛りFizzBuzz (Easy)
ユーザー data9824data9824
提出日時 2017-03-31 22:56:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 58,096 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-21 11:10:12
合計ジャッジ時間 1,303 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:22: warning: NULL used in arithmetic [-Wpointer-arith]
   if (i % fifteen == NULL) {
                      ^~~~
main.cpp:16:27: warning: NULL used in arithmetic [-Wpointer-arith]
   } else if (i % three == NULL) {
                           ^~~~
main.cpp:18:26: warning: NULL used in arithmetic [-Wpointer-arith]
   } else if (i % five == NULL) {
                          ^~~~
main.cpp:24:9: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
  return NULL;
         ^~~~

ソースコード

diff #

#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int one = (int)(cos(NULL));
	int three = (int)(cos(NULL) + cos(NULL) + cos(NULL));
	int five = (int)(cos(NULL) + cos(NULL) + cos(NULL) + cos(NULL) + cos(NULL));
	int fifteen = three * five;
	int n;
	cin >> n;
	for (int i = one; i <= n; ++i) {
		if (i % fifteen == NULL) {
			cout << "FizzBuzz" << endl;
		} else if (i % three == NULL) {
			cout << "Fizz" << endl;
		} else if (i % five == NULL) {
			cout << "Buzz" << endl;
		} else {
			cout << i << endl;
		}
	}
	return NULL;
}
0