zoj 2592 Think Positive(YY)
2013-09-07 21:59
218 查看
题意:把n个数(+1 或-1)放在一个圈上,问你有几个j 满足求和一圈前缀和 > 1
解题思路:个数就是n个数的和,这个优美的结论大家自己证明。。。
解题代码:
View Code
解题思路:个数就是n个数的和,这个优美的结论大家自己证明。。。
解题代码:
// File Name: f.c // Author: darkdream // Created Time: 2013年09月07日 星期六 14时28分49秒 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<time.h> #include<math.h> #define LL long long #define maxn 200005 //freopen("/home/plac/problem/input.txt","r",stdin); //freopen("/home/plac/problem/output.txt","w",stdout); int a[maxn]; int main(){ int t; scanf("%d",&t); while(t--) { int n; int sum = 0 ; scanf("%d",&n); while(n--) { int temp ; scanf("%d",&temp); sum += temp; } if(sum > 0 ) printf("%d\n",sum); else printf("0\n"); } return 0 ; }
View Code
相关文章推荐
- zoj 2592 Think Positive(5-F)
- zoj 2592 Think Positive(F)
- zoj 2592 Think Positive(5-F)
- zoj 2592 Think Positive(5-F)
- ZOJ 3829 Known Notation(模拟+YY)——The 2014 ACM-ICPC Asia Mudanjiang Regional Cont
- ZOJ&nbsp;1049&nbsp;I&nbsp;Think&amp;…
- 组队赛#1 解题总结 ZOJ 3803 YY's Minions (DFS搜索+模拟)
- ZOJ_1049_I Think I Need a Houseboat
- [Icpc] zoj 1048 / 1049 I Think I Need a Houseboat (v w)
- ZOJ 1049 (I Think I Need a Houseboat)
- [Icpc] zoj 1048 / 1049 I Think I Need a Houseboat (v w)
- ZOJ 1049 I Think I Need a Houseboat
- ZOJ 3804 YY's Minions
- Think Positive Thoughts Every Day
- ZOJ3804_YY's Minions 模拟
- ZOJ 3804 YY's Minions
- ZOJ3804:YY's Minions(模拟)
- I Think I Need a Houseboat ZOJ(几何计算)
- zoj-1047-I Think I Need a Houseboat
- ZOJ 2610 Puzzle (YY)