CodeForces 104 B 猜答案
来源:互联网 发布:上海税友有哪些软件 编辑:程序博客网 时间:2024/05/16 04:52
[Submit]
Description
The average miner Vaganych took refresher courses. As soon as aminer completes the courses, he should take exams. The hardest oneis a computer test called "Testing Pants for Sadness".
The test consists of
A click is regarded as selecting any answer in any question. Thegoal is to select the correct answer for each ofthe
Vaganych is very smart and his memory is superb, yet he isunbelievably unlucky and knows nothing whatsoever about the test'stheme. How many clicks will he have to perform in the worstcase?
Input
The first line contains a positiveinteger
Output
Print a single number — the minimal number of clicks needed topass the test it the worst-case scenario.
Please do not use the %lld specificator to read or write 64-bitintegers in С++. It is preferred to use the cin, cout streams orthe %I64d specificator.
Sample Input
21 1
2
22 2
5
110
10
Hint
Note to the second sample. In the worst-case scenario you willneed five clicks:
- the first click selects the first variant to the firstquestion, this answer turns out to be wrong.
- the second click selects the second variant to the firstquestion, it proves correct and we move on to the secondquestion;
- the third click selects the first variant to the secondquestion, it is wrong and we go back to question 1;
- the fourth click selects the second variant to the firstquestion, it proves as correct as it was and we move on to thesecond question;
- the fifth click selects the second variant to the secondquestion, it proves correct, the test is finished.
[Submit]
#include<iostream>#include<stdio.h>#include<cmath>const int MAX=105;__int64 a[MAX];using namespace std;int main(){ int n,i; bool f=true; __int64 sum,temp; while(scanf("%d",&n)!=EOF) { scanf("%I64d",&a[1]); if(n==1) { printf("%I64d\n",a[1]);continue;} sum=a[1]; for(i=2;i<=n;i++) { scanf("%I64d",&a[i]); temp=a[i]+(a[i]-1)*(i-1); sum+=temp; } printf("%I64d\n",sum); }return 0;}
- CodeForces 104 B 猜答案
- Codeforces 671B Robin Hood 二分答案
- codeforces 382B B. Number Busters [二分答案+数学]【思维】
- codeforces B
- codeforces B
- codeforces B
- codeforces B
- 二分答案 CodeForces
- 二分答案 Packmen CodeForces
- e 2 b 答案
- B. Pipeline----二分答案
- CodeForces 589F 二分答案
- 国家一级B选择题答案
- CodeForces 626B CodeForces 626B【暴力】
- CodeForces 841B (B) 博弈
- codeforces 134B
- codeforces#98 b
- codeforces 105 div2 B
- C++ string (2)
- hdu 1042 N!
- hdu 1066 阶乘最后非0位
- hdu 1039
- hdu 1019 最小公倍数(LCM)
- CodeForces 104 B 猜答案
- CodeForces 104A
- UVALive 4579 Time Lapse Camera
- hdu 3940 愤怒的小鸟
- linux - yum 安装配置mysql
- hdu 2031 进制转换
- hdu 1021 Fibonacc Again 找规律
- hdu 2036 改革春风吹满地
- 爱数发布AnyShare 3.5,打造私有云存储的BOX