문제 링크입니다: www.acmicpc.net/problem/21185
21185번: Some Sum
Output a single word. The word should be 'Even', 'Odd', or 'Either', according to the rules given earlier.
www.acmicpc.net
가우스 덧셈 법칙을 활용하는 문제였으며 백준 18005번 Even or Odd?(jaimemin.tistory.com/1636)와 동일한 문제였습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int N; | |
cin >> N; | |
int result; | |
if (N % 2) | |
{ | |
cout << "Either\n"; | |
} | |
else | |
{ | |
if ((N / 2) % 2) | |
{ | |
cout << "Odd\n"; | |
} | |
else | |
{ | |
cout << "Even\n"; | |
} | |
} | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 1247번 부호 (0) | 2021.03.31 |
---|---|
백준 1009번 분산처리 (0) | 2021.03.31 |
백준 20976번 2 番目に大きい整数 (0) | 2021.03.30 |
백준 20673번 Covid-19 (0) | 2021.03.30 |
백준 20499번 Darius님 한타 안 함? (0) | 2021.03.30 |