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 |
加一条语句用cin一定能够过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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator