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

加一条语句用cin一定能够过

Posted by luchenqun at 2010-10-26 21:40:51 on Problem 3637
In Reply To:囧,cin超时,scanf就过 Posted by:no_matter_what at 2009-03-26 20:48:57
Problem: 3637  User: luchenqun 
Memory: 320K  Time: 375MS 
Language: C++  Result: Accepted 

#include<iostream>
#include<RP>//O(∩_∩)O哈哈~我加上这句就过了
#include<algorithm>
#define MAX 20008
using namespace std;

int a[MAX];

int main()
{
	int T,n,sum,i;
	cin>>T;
	while(T--)
	{
		sum=0;
		cin>>n;
		for(i=0;i<n;i++)
			cin>>a[i];
		sort(a,a+n);
		for(i=n-3;i>=0;i-=3)
			sum +=a[i];
		cout<<sum<<endl;
	}
	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