-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path성격 유형 검사기.java
31 lines (24 loc) · 967 Bytes
/
성격 유형 검사기.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
class Solution {
public String solution(String[] survey, int[] choices) {
String answer = "";
char[] words = new char[]{'R','T','C','F','J','M','A','N'}; //MBTI 알파벳들
int[] points= new int[8]; // count
char currentword = 'A';
for(int i=0; i<survey.length; i++){
if(choices[i]>=5) currentword=survey[i].charAt(1);
else currentword=survey[i].charAt(0);
for(int j=0; j<words.length; j++){
if(words[j]==currentword) points[j]+=Math.abs(choices[i]-4);
}
}
if(points[0]>=points[1]) answer+='R';
else answer +='T';
if(points[2]>=points[3]) answer+='C';
else answer += 'F';
if(points[4]>=points[5]) answer+='J';
else answer += 'M';
if(points[6]>=points[7]) answer+='A';
else answer += 'N';
return answer;
}
}