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
相关文章推荐
- css 的@media print控制打印
- HDFS入门了解心得
- Knockout.js用jquery的val设置值不更新
- 剑指Offer之链表中倒数第k个节点(题15)
- AngularJS进阶(三十九)基于项目实战解析ng启动加载过程
- AngularJS进阶(三十九)基于项目实例解析ng启动加载过程
- 剑指Offer之调整数组使奇数位于偶数前面(题14)
- 剑指Offer之在O(1)时间删除链表节点(题13)
- 【Leetcode】Different Ways to Add Parentheses
- 剑指Offer——翻转单词顺序VS左旋转字符串
- 剑指Offer之打印1到最大的n位数(题12)
- 剑指Offer之数值的整数次方(题11)
- 剑指Offer之二进制中1的个数(题10)
- "_OBJC_CLASS_$_xxx", reference from:报错
- 剑指Offer之从斐波那契数列(题9)
- 一些元素居中的方法css的设置
- win7 64位+caffe+cuda7.5配置
- 剑指Offer之旋转数组中的最小数字(题8)
- 剑指Offer之用两个栈实现队列(题7)
- web工程中js文件有报错怎么办?