CF21C.Stripe 2
普及+/提高
通过率:0%
时间限制:1.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 three pieces so that the sum of numbers from each piece is equal to the sum of numbers from any 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 three non-empty pieces so that the sum of numbers from each piece is equal to the sum of numbers from any other piece. Don't forget that it's allowed to cut the stripe along the squares' borders only.
输出将该条带切成三个非空部分的方法数,使得每一部分中数字的和均相等。注意:仅允许沿方格的边界进行切割。
输入输出样例
输入#1
4 1 2 3 3
输出#1
1
输入#2
5 1 2 3 4 5
输出#2
0
输入解题思路,AI测评打分。不知道怎么写?