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

大家帮我看看为什么不对

Posted by cfc1243570631 at 2012-02-09 08:24:48 on Problem 3404
#include<iostream>
using namespace std;
int main()
{
	int i,n,t,s,*p;
	cin>>n;
	p=new int[n];
	for(i=0;i<n;i++)
		cin>>p[i];
	t=p[0];
	for(i=1;i<n;i++)
		if(p[i]<t)
			t=p[i];
		s=0;
	for(i=0;i<n;i++)
		s+=p[i];
	s+=t*(n-3);
	if(n>1)
		cout<<s<<endl;
	else
		cout<<p[0]<<endl;
	delete[]p;
	return 0;
}

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