結果
| 問題 |
No.9002 FizzBuzz(テスト用)
|
| ユーザー |
2355
|
| 提出日時 | 2024-05-17 15:11:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 584 bytes |
| コンパイル時間 | 597 ms |
| コンパイル使用メモリ | 64,032 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-20 11:45:11 |
| 合計ジャッジ時間 | 973 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 4 |
ソースコード
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter a number between 1 and 100: ";
cin >> n;
if (n < 1 || n > 100) {
cout << "Error: Input must be between 1 and 100." << endl;
return 1;
}
for (int i = 1; i <= n; i++) {
if (i % 3 == 0 && i % 5 == 0) {
cout << "FizzBuzz" << endl;
} else if (i % 3 == 0) {
cout << "Fizz" << endl;
} else if (i % 5 == 0) {
cout << "Buzz" << endl;
} else {
cout << i << endl;
}
}
return 0;
}
2355