Codeforces Round #200 (Div. 2), problem: (A) Magnets editorial: http://codeforces.com/blog/entry/8860
Codeforces Round #200 (Div. 2), problem: (A) Magnets solution: http://ideone.com/7tkaif
#include <iostream> #include <stdio.h> using namespace std; int main() { int n, cnt=1; string s, tmp; scanf("%d", &n); for(int i=0; i<n; i++) { cin>>s; if(i==0) {tmp=s; continue;} else {if(s!=tmp) cnt++;} tmp=s; } printf("%d", cnt); return 0; }
No comments:
Post a Comment