forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.cpp
More file actions
24 lines (18 loc) · 560 Bytes
/
1.cpp
File metadata and controls
24 lines (18 loc) · 560 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
#include <bits/stdc++.h>
using namespace std;
string str;
int summary = 0;
int main(void) {
cin >> str;
// 왼쪽 부분의 자릿수의 합 더하기
for (int i = 0; i < str.size() / 2; i++) {
summary += str[i] - '0';
}
// 오른쪽 부분의 자릿수의 합 빼기
for (int i = str.size() / 2; i < str.size(); i++) {
summary -= str[i] - '0';
}
// 왼쪽 부분과 오른쪽 부분의 자릿수 합이 동일한지 검사
if (summary == 0) cout << "LUCKY" << '\n';
else cout << "READY" << '\n';
}