Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

hi that is the solution

Posted by abdking1987 at 2006-08-13 04:04:28 on Problem 2636
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator