結果
問題 | No.3022 縛りFizzBuzz (Easy) |
ユーザー | shinwisteria |
提出日時 | 2017-03-31 22:47:19 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 623 bytes |
コンパイル時間 | 3,442 ms |
コンパイル使用メモリ | 72,360 KB |
実行使用メモリ | 55,988 KB |
最終ジャッジ日時 | 2023-09-21 11:04:05 |
合計ジャッジ時間 | 4,992 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
55,508 KB |
testcase_01 | AC | 129 ms
55,944 KB |
testcase_02 | AC | 130 ms
55,768 KB |
testcase_03 | AC | 136 ms
55,988 KB |
ソースコード
import java.util.Scanner; public class FizzBuzz { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner s = new Scanner(System.in); int N = s.nextInt(); s.close(); String str = "abcdef"; int t = str.indexOf("d"); int f = str.indexOf("f"); int zero = str.indexOf("a"); for(int i = str.indexOf("b");i <= N;i++){ if(i % t == zero&&i % f == zero){ System.out.println("FizzBuzz"); }else if(i%t == zero){ System.out.println("Fizz"); }else if(i % f == zero){ System.out.println("Buzz"); }else{ System.out.println(i); } } } }