-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest33.java
More file actions
33 lines (29 loc) · 889 Bytes
/
Copy pathTest33.java
File metadata and controls
33 lines (29 loc) · 889 Bytes
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
package programmers;
import java.util.Arrays;
public class Test33 {
public int[] solution(int[] lottos, int[] win_nums) {
int[] rank = {6,6,5,4,3,2,1};
int highcnt=0;
int cnt=0;
for (int i = 0; i < lottos.length; i++) {
for(int j=0;j<lottos.length;j++){
if (lottos[i] == win_nums[j]) {
cnt++;
}
}
}
for(int i=0;i<lottos.length;i++){
if(lottos[i]==0){
highcnt++;
}
}
int[] answer = {rank[cnt+highcnt],rank[cnt]};
return answer;
}
public static void main(String[] args) {
Test33 test = new Test33();
int[] lottos = {45, 4, 35, 20, 3, 9};
int[] win_nums = {20, 9, 3, 45, 4, 35};
System.out.println(Arrays.toString(test.solution(lottos,win_nums)));
}
}