백준 7567 c++

magicdrill·2024년 7월 26일

백준 문제풀이

목록 보기
403/673

백준 7567 c++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int i;
	string dish;
	int total = 10;

	cin >> dish;
	for (i = 1; i < dish.length(); i++)
	{
		if (dish[i] == dish[i - 1])
		{
			total += 5;
		}
		else
		{
			total += 10;
		}
	}
	cout << total << "\n";

	return 0;
}

0개의 댓글