#include <iostream> using namespace std; int main(){ int l, m, a, b, c, w; cin >> l; for(int i = 0; i < l; ++i){ cin >> m; w = 0; for(int j = 0; j < m; ++j){ cin >> a >> b >> c; w += a * b; w -= a * c; } if( w == 0) cout << "TAK" << '\n'; else cout << "NIE" << '\n'; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <iostream> using namespace std; int main(){ int l, m, a, b, c, w; cin >> l; for(int i = 0; i < l; ++i){ cin >> m; w = 0; for(int j = 0; j < m; ++j){ cin >> a >> b >> c; w += a * b; w -= a * c; } if( w == 0) cout << "TAK" << '\n'; else cout << "NIE" << '\n'; } } |