2016 CCPC-Final
Posted ouyang_wsgwz
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2016 CCPC-Final相关的知识,希望对你有一定的参考价值。
The Third Cup is Free

1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 inline int read() 5 { 6 int x=0,f=1;char ch=getchar(); 7 while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1;ch=getchar();} 8 while(ch>=‘0‘&&ch<=‘9‘){x=x*10+ch-‘0‘;ch=getchar();} 9 return x*f; 10 } 11 12 /********************************************************************/ 13 14 const int maxn = 1e5+7; 15 int a[maxn]; 16 17 bool cmp(int x, int y){ 18 return x > y; 19 } 20 21 int main(){ 22 int t; t = read(); 23 int cnt = 0; 24 while(t--){ 25 cnt++; 26 int n; n = read(); 27 for(int i = 1;i <= n;i++){ 28 a[i] = read(); 29 } 30 sort(a+1, a+1+n, cmp); 31 int ans = 0; 32 for(int i = 1;i <= n;i++){ 33 if(i%3 == 0) continue; 34 ans += a[i]; 35 } 36 printf("Case #%d: %d ", cnt, ans); 37 } 38 return 0; 39 }
以上是关于2016 CCPC-Final的主要内容,如果未能解决你的问题,请参考以下文章