結果
問題 |
No.1032 数数え
|
ユーザー |
![]() |
提出日時 | 2024-07-10 17:46:15 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,426 bytes |
コンパイル時間 | 3,008 ms |
コンパイル使用メモリ | 94,292 KB |
実行使用メモリ | 57,948 KB |
最終ジャッジ日時 | 2024-07-10 17:46:24 |
合計ジャッジ時間 | 6,302 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 10 |
ソースコード
import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); int[] counts = new int[m]; while (n-- > 0) { int x = sc.nextInt(); if (x <= m) { counts[x - 1]++; } } System.out.println(Arrays.stream(counts).mapToObj(String::valueOf).collect(Collectors.joining("\n"))); } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }