您的位置:首页 > Web前端

codeforces 675C Money Transfers map

2016-05-26 22:04 357 查看
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <map>
#include <queue>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const int N=1e3+5;
map<LL,int>mp;
int main(){
int n;
scanf("%d",&n);
int ans=n-1;
LL sum=0;
for(int i=0;i<n;++i){
int t;
scanf("%d",&t);
sum+=t;
++mp[sum];
ans=min(ans,n-mp[sum]);
}
printf("%d\n",ans);
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: