Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 개발
- 백준
- vector
- 정석학술정보관
- bfs
- DP
- 컴공과
- 자료구조
- 코테
- 스택
- 코딩
- Operating System
- 그래프
- 브루트포스
- cs
- 컴퓨터공학과
- 북리뷰
- 정석
- coding
- 컴공
- 구현
- 문제풀이
- c++
- OS
- 너비우선탐색
- Stack
- Computer science
- 오퍼레이팅시스템
- 오에스
- 알고리즘
Archives
- Today
- Total
Little Jay
[C++] 백준 2511번 카드놀이 본문
약간은 짜증났던 문제?
당연히 A,B의 승리만 계산하면 되는건줄 알았는데
비겨도 A,B의 승리는 존재하고,
전부다 비길 때를 고려해야하는?
그래서 3번 틀림......
#include <iostream>
using namespace std;
int main() {
int arr1[10];
int arr2[10];
int aPoint = 0, bPoint = 0;
char win = 'D';
for (int i = 0; i < 10; i++) {
cin >> arr1[i];
}
for (int i = 0; i < 10; i++) {
cin >> arr2[i];
}
for (int i = 0; i < 10; i++) {
if (arr1[i] > arr2[i]) {
aPoint += 3;
win = 'A';
}
else if (arr1[i] == arr2[i]) {
aPoint++;
bPoint++;
}
else {
bPoint += 3;
win = 'B';
}
}
cout << aPoint << " " << bPoint << "\n";
if (aPoint > bPoint) {
cout << 'A';
}
else if (aPoint < bPoint) {
cout << 'B';
}
else {
cout << win;
}
cout << "\n";
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
[C++] 백준 14656번 조교는 새디스트야!! (0) | 2021.03.06 |
---|---|
[C++] 백준 2566번 최댓값 (0) | 2021.03.06 |
[C++] 백준 2587번 대표값2 (0) | 2021.03.05 |
[C++] 백준 2750번 수 정렬하기 (0) | 2021.03.05 |
[C++] 백준 2593번 대표값 (0) | 2021.03.04 |
Comments