HDU - 6106 Classes
2017-08-20 21:43
429 查看
//水题 #include <iostream> #include <algorithm> using namespace std; const int maxn = 105; int a[7], b[7]; int store[maxn]; void showa() { for (int i = 0; i < 7; i++) cout << a[i] << " "; cout << endl; } void showb() { for (int i = 0; i < 7; i++) cout << b[i] << " "; cout << endl; } bool check() { for (int i = 0; i < 7; i++) if (b[i] < 0) return false; return true; } bool GetBFromA() { b[6] = a[6]; for (int i = 3; i < 6; i++) b[i] = a[i] - a[6]; b[0] = a[0] - b[3] - b[5] - b[6]; b[1] = a[1] - b[3] - b[4] - b[6]; b[2] = a[2] - b[4] - b[5] - b[6]; return (check()); } int sumb() { int sum = 0; for (int i = 0; i < 7; i++) sum += b[i]; return sum; } int main() { int t, cnt; int N; cin >> t; while (t--) { cnt = 0; cin >> N; for (int i = 0; i < N; i++) { for (int j = 0; j < 7; j++) cin >> a[j]; // showa(); GetBFromA(); // showb(); if (check()) { store[cnt] = sumb(); cnt++; // cout << "test " << endl; } else continue; } sort(store, store+cnt); cout << store[--cnt] << endl; } return 0; }
相关文章推荐
- HDU 6106 Classes (水题)
- HDU 6106-Classes
- HDU 6106 Classes
- 2017 多校训练第六场 HDU 6106 Classes
- hdu 6106.Classes
- HDU 6106 Classes【水题】
- HDU 6106 Classes 【】
- HDU 6106 Classes -逻辑题-2017多效联盟6 第11题
- HDU 6106 Classes【简单思维】
- HDU 6106 (2017 多校训练赛6 1011)Classes
- hdu 6106 Classes 2017多校第六场1011签到题 容斥原理
- hdu 6106 Classes
- HDU 6106 Classes (简单集合运算 17多校第六场)
- HDU 6106 Classes
- HDU 6106 17多校6 Classes(容斥简单题)
- 【2017多校】HDU 6106 Classes 【集合计算】
- HDU - 6106 Classes(阅读题)
- 【HDU 6106 Classes】
- HDU 6106 Classes(水~)
- hdu-6106-Classes