-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP435.java
57 lines (37 loc) · 945 Bytes
/
P435.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package aceptaelreto;
import java.util.Scanner;
public class p435 {
static Scanner s;
public static void main(String[] args) {
s = new Scanner(System.in);
int[] repNums = new int[10];
while(s.hasNext()) {
init(repNums);
String[] nums = s.nextLine().split("");
for(String num : nums) {
try{
int numr = Integer.parseInt(num);
repNums[numr]++;
} catch (Exception e) {
}
}
System.out.println(subnormal(repNums) ? "subnormal" : "no subnormal" );
}
}
static boolean subnormal(int[] nums){
int value = nums[0];
boolean subnormal = true;
for(int i=1;i<nums.length;i++){
if(nums[i] != value){
subnormal = false;
break;
}
}
return subnormal;
}
static void init(int[] repNums) {
for(int i = 0;i<10;i++) {
repNums[i] = 0;
}
}
}