結果

問題 No.542 1円玉と5円玉
ユーザー tentententen
提出日時 2022-09-13 10:53:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 1,383 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 77,900 KB
実行使用メモリ 37,216 KB
最終ジャッジ日時 2024-05-07 19:00:56
合計ジャッジ時間 3,426 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
37,128 KB
testcase_01 AC 51 ms
36,836 KB
testcase_02 AC 50 ms
36,580 KB
testcase_03 AC 50 ms
36,760 KB
testcase_04 AC 51 ms
36,672 KB
testcase_05 AC 51 ms
37,132 KB
testcase_06 AC 51 ms
36,828 KB
testcase_07 AC 50 ms
36,992 KB
testcase_08 AC 53 ms
37,204 KB
testcase_09 AC 51 ms
37,216 KB
testcase_10 AC 50 ms
37,168 KB
testcase_11 AC 52 ms
37,100 KB
testcase_12 AC 50 ms
36,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int[] imos = new int[b * 5 + a + 2];
        for (int i = 0; i <= b; i++) {
            imos[i * 5]++;
            imos[i * 5 + a + 1]--;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i < imos.length; i++) {
            imos[i] += imos[i - 1];
            if (imos[i] > 0) {
                sb.append(i).append("\n");
            }
        }
        System.out.print(sb);
    }
}
    
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0