문제

링크

풀이

#include <algorithm>
#include <iostream>
using namespace std;
 
void solve(void) {
  int n; cin >> n;
 
  int ans = 0;
  while (n--) {
    int a, b, c; cin >> a >> b >> c;
    if (max({a, b, c}) < 0) continue;
    ans += max({a, b, c});
  }
  cout << ans << "\n";
}
 
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
 
  int t; cin >> t;
  while (t--) solve();
  return 0;
}