Testing Pants for Sadness
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".
The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to question n . Question i contains ai answer variants, exactly one of them is correct.
A click is regarded as selecting any answer in any question. The goal is to select the correct answer for each of the n questions. If Vaganych selects a wrong answer for some question, then all selected answers become unselected and the test starts from the very beginning, from question 1 again. But Vaganych remembers everything. The order of answers for each question and the order of questions remain unchanged, as well as the question and answers themselves.
Vaganych is very smart and his memory is superb, yet he is unbelievably unlucky and knows nothing whatsoever about the test's theme. How many clicks will he have to perform in the worst case?
题意翻译
有个人要做n 道选择题,必须按1∼n 的顺序答题,第i 题有ai 个选项。不幸的是,这些题这个人一道也不会,只能猜选项,但是他的记忆非常好,可以记住所有题曾经的正确选项。当他做错一道题时,他就必须从1 重新开始选,假设题目的正确选项不会变,在最坏的情况下,若要做对所有题,他一共选了多少次选项?
1≤n≤100,1≤ai≤109
Input Format
The first line contains a positive integer n ( 1<=n<=100 ). It is the number of questions in the test. The second line contains space-separated n positive integers , the number of answer variants to question i .
翻译:第一行是一个整数n,它是测试中的问题数。
第二行第二行包含空格分隔的n个正整数ai,代表这题选项的数量;
Output Format
Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario.
Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator.
打印一个数字-在最坏的情况下通过测试所需的最少点击次数。
2
2 2
5
Hint
注意第二个样品。在最坏的情况下,您需要单击五次:
第一次点击选择第一个问题的第一个变体,结果这个答案是错误的。
第二次点击选择第一个问题的第二个变体,它证明是正确的,我们继续第二个问题;
第三次点击选择第二个问题的第一个变体,它是错误的,我们回到问题1;
我们选择第二个问题来证明第二个问题是正确的;
第五次点击选择第二个问题的第二个变量,证明正确,测试结束。
ACM集训队第一次排位赛(女生赛)
- 状态
- 已结束
- 规则
- ACM/ICPC
- 题目
- 6
- 开始于
- 2020-11-21 13:30
- 结束于
- 2020-11-21 16:05
- 持续时间
- 2.6 小时
- 主持人
- 参赛人数
- 11