히히
5549. 홀수일까 짝수일까 본문
https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWWxpEDaAVoDFAW4
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 <iostream> #include <cstring> using namespace std; int main() { int test_case; int T; char num[102]; cin >> T; for (test_case = 1; test_case <= T; ++test_case) { cin >> num; int len = strlen(num); if (num[len - 1] % 2 == 0) { cout << "#" << test_case << " " << "Even"; } else { cout << "#" << test_case << " " << "Odd"; } cout << endl; } } |
문제에 100자리 이하의 숫자를 받는다고 해서.. 음
바보같이 롱롱 썼다가 아 안되는구나 하고 문자로 배열에 받았따.
strlen 공부했다.
'study > SWEP' 카테고리의 다른 글
4406. 모음이 보이지 않는 사람 (0) | 2018.11.20 |
---|---|
5789. 현주의 상자 바꾸기 (0) | 2018.11.19 |
4299. 태혁이의 사랑은 타이밍 (0) | 2018.11.19 |
1206. View (0) | 2018.11.18 |
5431. 민석이의 과제 체크 (0) | 2018.11.18 |
Comments