标签:getch line 技术 c++ ase max its namespace char
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\n", cnt, ans); 37 } 38 return 0; 39 }
标签:getch line 技术 c++ ase max its namespace char
原文地址:https://www.cnblogs.com/ouyang_wsgwz/p/9765501.html