문제 링크입니다: https://www.acmicpc.net/problem/8725
8725번: Szachy
Tatuś małego Pawełka jest znanym na świecie arcymistrzem szachowym i bardzo chciałby, żeby jego synek podążył jego śladami. Dlatego zaczął go już uczyć grać w szachy, mimo młodego wieku chłopca. Niestety Pawełkowi kiepsko idzie nauka, naj
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> | |
#include <algorithm> | |
using namespace std; | |
const int INF = 987654321; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int n; | |
cin >> n; | |
int result = 0; | |
for (int i = 0; i < n; i++) | |
{ | |
int rowMax = -INF; | |
for (int j = 0; j < n; j++) | |
{ | |
int score; | |
cin >> score; | |
rowMax = max(rowMax, score); | |
} | |
result += max(0, rowMax); | |
} | |
cout << result << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 8815번 Test (0) | 2021.06.28 |
---|---|
백준 8806번 Papier kamień nożyczki (0) | 2021.06.27 |
백준 8721번 Wykreślanka (0) | 2021.06.27 |
백준 8719번 Piłeczka (0) | 2021.06.27 |
백준 8716번 Pole (0) | 2021.06.27 |