From 1986bbbe3ef4f5cbc80ffddc590927677517c5db Mon Sep 17 00:00:00 2001 From: KiriAky 107 Date: Fri, 19 Sep 2025 18:34:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=AC=A1=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E8=AF=BE=E4=BB=A3=E7=A0=81=20=E6=B7=BB=E5=8A=A0NumberCounter?= =?UTF-8?q?=E5=92=8CEncryptDemo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- C03 ControlFlow/C03 ControlFlow.iml | 11 +++++++++++ C03 ControlFlow/src/NumberCounter.java | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 C03 ControlFlow/C03 ControlFlow.iml create mode 100644 C03 ControlFlow/src/NumberCounter.java diff --git a/C03 ControlFlow/C03 ControlFlow.iml b/C03 ControlFlow/C03 ControlFlow.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/C03 ControlFlow/C03 ControlFlow.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/C03 ControlFlow/src/NumberCounter.java b/C03 ControlFlow/src/NumberCounter.java new file mode 100644 index 0000000..a800a90 --- /dev/null +++ b/C03 ControlFlow/src/NumberCounter.java @@ -0,0 +1,17 @@ +import java.util.Scanner; + +public class NumberCounter { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + long num = sc.nextLong(); + int[] hash = new int[10]; + while(num>0){ + hash[(int)(num%10)]++; + num/=10; + } + + for(int i : hash) + System.out.print(i+" "); + System.out.println(); + } +}