| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
hi that is the solution#include <iostream>
using namespace std;
void main()
{
int n,k,sum=0,x;
cin>>n;
for(int i=0;i<n;i++)
{
sum=0;
cin>>k;
for(int j=1;j<=k;j++)
{
cin>>x;
if(k==j)
{
sum+=x;
break;
}
x=x-1;
sum+=x;
}
cout<<sum<<endl;
}
cin>>n;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator