【题解】Tanya and Candies
Tanya has nn candies numTanya and Candies bered from 11 to nn. The ii-th candy has the weight aiai.
She plans to eat exactly n−1n−1 candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.
Your task is to find the number of such candies ii (let's call these candies good) that if dad gets the ii-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days. Note that at first, she will give the candy, after it she will eat the remaining candies one by one.
For example, n=4n=4 and weights are [1,4,3,3][1,4,3,3]. Consider all possible cases to give a candy to dad:
- Tanya gives the 11-st candy to dad (a1=1a1=1), the remaining candies are [4,3,3][4,3,3]. She will ea

Tanya有n个糖果,她计划每天吃一个,最后一天将剩余的糖果给她爸爸。任务是找到有多少个糖果如果给她爸爸,可以使得她在偶数天吃的糖果重量总和等于奇数天。题目给出了所有糖果的重量,需要找出符合条件的糖果个数。
最低0.47元/天 解锁文章
391

被折叠的 条评论
为什么被折叠?



