Sunday, July 13, 2014

Codeforces Round #147 (Div. 2), problem: (A) Free Cash solution

Codeforces Round #147 (Div. 2), problem: (A) Free Cash: http://codeforces.com/problemset/problem/237/A

Codeforces Round #147 (Div. 2), problem: (A) Free Cash solution: http://ideone.com/IorzL2


#include <iostream>
#include <cstdio>
using namespace std;

int main() {
    int n, h, m, a, b, cnt=1, ma=1;
    scanf("%d", &n);
    for(int i=0; i<n; i++) {
        scanf("%d%d", &h, &m);
        if(i==0) a=h, b=m;
        else {
            if(a==h && b==m) cnt++;
            else {
                a=h, b=m;
                if(cnt>ma) ma=cnt;
                cnt=1;
            }
            if(cnt>ma) ma=cnt;
        }
    }
    printf("%d", ma);
    return 0;
}


No comments:

Post a Comment