Recent Posts
Notice
No Rules Rules
탁구 경기 (feat. 백준, 27918번) 본문
728x90
반응형
탁구 경기
https://www.acmicpc.net/problem/27918
27918번: 탁구 경기
달구와 포닉스는 탁구 치는 것을 좋아한다. 윤이는 오늘도 탁구를 치는 달구와 포닉스를 보고, 누가 경기에서 승리할지 예측해 보기로 했다. 달구와 포닉스가 탁구 경기를 진행하는 규칙은 다음
www.acmicpc.net
// woohyeon.kim
// kim519620.tistory.com
#include <iostream>
#include <queue>
#include <math.h>
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(NULL);
register int N, point1 = 0, point2 = 0;
cin >> N;
char ch;
queue<char> q;
for(register int n = 0; n < N; ++n)
cin >> ch, q.push(ch);
while(!q.empty()){
ch = q.front(); q.pop();
if(ch == 'D')
++point1;
else
++point2;
if(abs(point1 - point2) == 2)
break;
}
cout << point1 << ':' << point2;
return 0;
}
// *&)*@*
반응형
단순 연산 문제입니다.
728x90
반응형
'생활 > 코테' 카테고리의 다른 글
지능형 기차 (feat. 백준, 2455번) (0) | 2023.03.27 |
---|---|
사분면 (feat. 백준, 9610번) (0) | 2023.03.27 |
다음 소수 (feat. 백준, 4134번) (0) | 2023.03.23 |
시그마 (feat. 백준, 2355번) (0) | 2023.03.23 |
하얀 칸 (feat. 백준, 1100번) (0) | 2023.03.22 |
Comments