CF18C.Stripe
普及-
通过率:0%
时间限制:2.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Once Bob took a paper stripe of n squares (the height of the stripe is 1 square). In each square he wrote an integer number, possibly negative. He became interested in how many ways exist to cut this stripe into two pieces so that the sum of numbers from one piece is equal to the sum of numbers from the other piece, and each piece contains positive integer amount of squares. Would you help Bob solve this problem?
曾经,鲍勃拿了一条由 n 个方格组成的纸带(纸带高度为 1 个方格)。他在每个方格中写下一个整数(可能为负数)。他开始好奇:有多少种方法可以将这条纸带切成两段,使得其中一段所有数字之和等于另一段所有数字之和,并且每一段都必须包含正整数个方格?你愿意帮鲍勃解决这个问题吗?
输入格式
The first input line contains integer n (1 ≤ n ≤ 105) — amount of squares in the stripe. The second line contains n space-separated numbers — they are the numbers written in the squares of the stripe. These numbers are integer and do not exceed 10000 in absolute value.
第一行输入包含一个整数 n(1≤n≤105)—— 表示条带中正方形的数量。
第二行包含 n 个以空格分隔的数字——它们是条带中各个正方形上所写的数字。这些数字均为整数,且其绝对值不超过 10000。
输出格式
Output the amount of ways to cut the stripe into two non-empty pieces so that the sum of numbers from one piece is equal to the sum of numbers from the other piece. Don't forget that it's allowed to cut the stripe along the squares' borders only.
输出将该条带切割成两个非空部分的方法数,使得其中一部分的数字之和等于另一部分的数字之和。注意:只允许沿方格的边界进行切割。
输入输出样例
输入#1
9 1 5 -6 7 9 -16 0 -2 2
输出#1
3
输入#2
3 1 1 1
输出#2
0
输入#3
2 0 0
输出#3
1
输入解题思路,AI测评打分。不知道怎么写?