- Notifications
You must be signed in to change notification settings - Fork 846
/
Copy path1.java
26 lines (20 loc) · 750 Bytes
/
1.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
importjava.util.*;
publicclassMain {
publicstaticStringstr;
publicstaticintsummary = 0;
publicstaticvoidmain(String[] args) {
Scannersc = newScanner(System.in);
str = sc.next();
// 왼쪽 부분의 자릿수의 합 더하기
for (inti = 0; i < str.length() / 2; i++) {
summary += str.charAt(i) - '0';
}
// 오른쪽 부분의 자릿수의 합 빼기
for (inti = str.length() / 2; i < str.length(); i++) {
summary -= str.charAt(i) - '0';
}
// 왼쪽 부분과 오른쪽 부분의 자릿수 합이 동일한지 검사
if (summary == 0) System.out.println("LUCKY");
elseSystem.out.println("READY");
}
}