문제 링크입니다: https://www.acmicpc.net/problem/9517
9517번: 아이 러브 크로아티아
"I love Croatia"는 네델란드의 인기 티비 프로그램 "I love my country"의 포맷 라이센스를 수입해 만든 크로아티아의 티비쇼이다. 이 티비쇼에서 가장 인기있는 게임은 "Happy Birthday"이며, 이 게임에 대한
www.acmicpc.net
간단한 구현 문제였습니다.
This file contains 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 = 210; | |
const int MOD = 8; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int K, N; | |
cin >> K >> N; | |
int total = 0; | |
for (int n = 0; n < N; n++) | |
{ | |
int T; | |
char Z; | |
cin >> T >> Z; | |
total += T; | |
if (total >= MAX) | |
{ | |
break; | |
} | |
if (Z == 'T') | |
{ | |
K++; | |
} | |
if (K > MOD) | |
{ | |
K %= MOD; | |
} | |
} | |
cout << K << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 25501번 재귀의 귀재 (0) | 2022.08.28 |
---|---|
백준 15235번 Olympiad Pizza (0) | 2022.08.04 |
백준 4562번 No Brainer (1) | 2021.07.22 |
백준 9493번 길면 기차, 기차는 빨라, 빠른 것은 비행기 (0) | 2021.07.20 |
백준 9469번 폰 노이만 (0) | 2021.07.19 |