Codeforces 344A Magnets

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/polanwind/article/details/84075509
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int main() {
	int n,ntemp;
	cin >> n;
	ntemp = n;
	int ans = 0;
	string pres;
	while (ntemp--) {
		string s;
		cin >> s;
		if(ntemp==n){
			pres = s;
		}
		else {
			if (pres != s) {
				ans++;
				pres = s;
			}
		}
	}
	cout << ans << endl;
	//system("pause");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/polanwind/article/details/84075509
今日推荐