문제 링크입니다: www.acmicpc.net/problem/18411
18411번: 試験
JOI 君は情報の試験を 3 回受けた.試験の点数はすべて 0 以上 100 以下の整数である. JOI 君の成績は 3 回の試験の点数のうち高い方から 2 つを足し合わせた合計によって決まる. 3 回
www.acmicpc.net
간단한 구현 문제였습니다.
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; | |
const int MAX = 3; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int oneCnt = 0, twoCnt = 0; | |
for (int i = 0; i < MAX; i++) | |
{ | |
int num; | |
cin >> num; | |
num == 1 ? oneCnt++ : twoCnt++; | |
} | |
cout << (oneCnt > twoCnt ? "1\n" : "2\n"); | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 19602번 Dog Treats (0) | 2021.03.27 |
---|---|
백준 18414번 X に最も近い値 (0) | 2021.03.27 |
백준 18408번 3 つの整数 (0) | 2021.03.27 |
백준 18330번 Petrol (0) | 2021.03.27 |
백준 18005번 Even or Odd? (0) | 2021.03.27 |