Recent Posts
Notice
No Rules Rules
그릇 (feat. 백준, 7567번) 본문
728x90
반응형
그릇
https://www.acmicpc.net/problem/7567
// woohyeon.kim
// kim519620.tistory.com
#include <iostream>
#include <string>
using namespace std;
int main(){
ios::sync_with_stdio(false), cin.tie(NULL);
string str;
register int ans = 0;
char tmp = 0;
cin >> str;
for(auto& ch : str){
if(tmp == 0)
ans += 10, tmp = ch;
else{
if(tmp == ch)
ans += 5;
else
ans += 10, tmp = ch;
}
}
cout << ans;
return 0;
}
// *&)*@*
반응형
이전 문자를 저장하고 입력된 문자와 비교하는 연산 문제입니다.
728x90
반응형
'생활 > 코테' 카테고리의 다른 글
최댓값 (feat. 백준, 2566번) (0) | 2022.10.24 |
---|---|
주몽 (feat. 백준, 1940번) (0) | 2022.10.21 |
단어 뒤집기 (feat. 백준, 9093번) (0) | 2022.10.21 |
욕심쟁이 판다 (feat. 백준, 1937번) (0) | 2022.10.21 |
전자레인지 (feat. 백준, 10162번) (0) | 2022.10.21 |
Comments