結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2018-04-14 15:20:07
言語 Java19
(openjdk 21)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 625 bytes
コンパイル時間 2,111 ms
コンパイル使用メモリ 72,076 KB
実行使用メモリ 56,528 KB
最終ジャッジ日時 2023-09-11 04:36:13
合計ジャッジ時間 7,458 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
56,192 KB
testcase_01 AC 124 ms
55,796 KB
testcase_02 AC 123 ms
55,864 KB
testcase_03 AC 122 ms
56,208 KB
testcase_04 AC 126 ms
56,180 KB
testcase_05 AC 125 ms
55,892 KB
testcase_06 AC 124 ms
56,264 KB
testcase_07 AC 126 ms
56,204 KB
testcase_08 AC 124 ms
56,240 KB
testcase_09 AC 126 ms
55,828 KB
testcase_10 AC 126 ms
55,696 KB
testcase_11 AC 125 ms
55,972 KB
testcase_12 AC 124 ms
55,640 KB
testcase_13 AC 127 ms
55,940 KB
testcase_14 AC 124 ms
55,648 KB
testcase_15 AC 123 ms
56,000 KB
testcase_16 AC 123 ms
55,460 KB
testcase_17 AC 123 ms
56,528 KB
testcase_18 AC 122 ms
56,084 KB
testcase_19 AC 122 ms
55,948 KB
testcase_20 AC 122 ms
56,112 KB
testcase_21 AC 120 ms
55,812 KB
testcase_22 AC 127 ms
56,268 KB
testcase_23 AC 126 ms
56,020 KB
testcase_24 AC 122 ms
55,776 KB
testcase_25 AC 122 ms
55,944 KB
testcase_26 AC 125 ms
55,736 KB
testcase_27 AC 125 ms
56,032 KB
testcase_28 AC 126 ms
55,832 KB
testcase_29 AC 123 ms
55,504 KB
testcase_30 AC 122 ms
56,124 KB
testcase_31 AC 125 ms
56,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static StringBuilder sb = new StringBuilder("");
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for(int i = 0; i < 5; i++) {
            int n = sc.nextInt();
            solve(n);
        }
        System.out.println(sb.toString().length());
    }
    
    static void solve(int n) {
        if(n%15 == 0) {
            sb.append("FizzBuzz");
        } else if(n%3 ==0) {
            sb.append("Fizz");
        } else if(n%5 ==0) {
            sb.append("Buzz");
        } else {
            sb.append(n);
        }
    }
}
0