Codeforces 6C. Alice, Bob and Chocolate
来源:互联网 发布:js如何创建数组 编辑:程序博客网 时间:2024/05/16 17:34
代码:
#include <stdio.h>const int MAXN = 100005;int seq[MAXN];int main(){#ifdef _LOCAL freopen("F://input.txt", "r", stdin);#endif int n; scanf("%d", &n); for(int i = 1; i <= n; ++i) scanf("%d", &seq[i]); if(n == 1) { printf("1 0\n"); return 0; } int first = 1, last = n, eatA = seq[first], eatB = seq[last]; while(1) { if(eatA <= eatB && first + 1 < last) eatA += seq[++first]; else if(eatB < eatA && last - 1 > first) eatB += seq[--last]; else break; } printf("%d %d", first, n - last + 1); return 0;}
0 0
- codeforces 6C - Alice, Bob and Chocolate
- Codeforces 6C. Alice, Bob and Chocolate
- CodeForces 6C - Alice, Bob and Chocolate
- CodeForces 6C Alice, Bob and Chocolate
- CodeForces 6C Alice, Bob and Chocolate
- Alice, Bob and Chocolate CodeForces
- Round #6 C.Alice, Bob and Chocolate
- CF 6C Alice, Bob and Chocolate
- 6C - Alice, Bob and Chocolate
- codeforce 6C - Alice, Bob and Chocolate
- Codeforces Beta Round #6 (Div. 2 Only) C. Alice, Bob and Chocolate
- Codeforces Round #6——C. Alice, Bob and Chocolate(想法题)
- Alice, Bob and Chocolate
- Alice, Bob and Chocolate
- Round #6 C.Alice, Bob and Chocolate-二分
- G - Alice, Bob and Chocolate
- CodeForces 347 C. Alice and Bob
- Codeforces 347C Alice and Bob
- XE7 BCB不带Midas.dll发布的方法
- 修改linux主机名称
- pow(x, n),有时递归的时候要注意用变量保存中间结果
- [ZedBoard移植嵌入式Linux教程(4)]创建设备树(Device-Tree)文件dts
- 数据结构二叉查找树C++实现
- Codeforces 6C. Alice, Bob and Chocolate
- 【LeetCode】Combinations 解题报告
- android SlidingMenu sample的j简单写法
- C++如何合并若干个vector
- C++多态的实现原理
- lua实现sleep
- iOS_版本用户更新
- Android手机耗电深度解析:3G耗电是WiFi四倍
- 快速排序的非递归实现