| ||||||||||
| 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一定能够过 Posted by:luchenqun at 2010-10-26 21:40:51 #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAXN 32768
using namespace std;
int t, n, num[MAXN];
int main()
{
ios::sync_with_stdio(false);
cin >> t;
while (t--)
{
cin >> n;
for (int i = 1; i <= n; ++i) cin >> num[i];
sort(num + 1, num + n + 1);
int sum = 0;
for (int i = n - 2; i >= 1; i -= 3) sum += num[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