結果
| 問題 |
No.9002 FizzBuzz(テスト用)
|
| ユーザー |
|
| 提出日時 | 2016-12-15 10:46:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 130 ms / 5,000 ms |
| コード長 | 681 bytes |
| コンパイル時間 | 2,104 ms |
| コンパイル使用メモリ | 75,252 KB |
| 実行使用メモリ | 41,696 KB |
| 最終ジャッジ日時 | 2024-11-30 08:17:03 |
| 合計ジャッジ時間 | 3,176 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 |
ソースコード
import java.util.Scanner;
public class Main {
static final String FIZZ = "Fizz";
static final String BUZZ = "Buzz";
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// N(1≤N≤100)
int num = sc.nextInt();
for (int i=1; i<=num; i++) {
if (i % 3 == 0 && i % 5 == 0) {
System.out.print(FIZZ + BUZZ);
} else if (i % 3 == 0) {
System.out.print(FIZZ);
} else if (i % 5 == 0) {
System.out.print(BUZZ);
} else {
System.out.print(i);
}
System.out.println();
}
}
}