[Offer收割]编程练习赛12 register

Ended

Participants:1323

Verdict:Accepted
Score:100 / 100
Submitted:2017-04-02 12:19:06

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int main() {
    int n;
    cin>>n;
    for(int i = 0; i < n; i++) {
        int cnt, wid, cur = 0;
        scanf("%d", &cnt);
        for(int j = 0; j < cnt; j++) {
            scanf("%d", &wid);
            if(j+1 == cnt) continue;
            cur += wid;
            mp[cur]++;
            //cout<<cur<<endl;
        }
    }
    int mx = 0;
    for(map<int, int>::iterator it = mp.begin(); it != mp.end(); it++) {
        mx = max(mx, it->second);
    }
    cout<<n-mx<<endl;
    //int aaa;cin>>aaa;
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX