#include <iostream> int main(int argc, const char * argv[]) { int t, n, a, b, c; long is, want; std::cin >> t; for (int i =0; i<t; i++) { std::cin >> n; is = 0; want = 0; for (int j =0; j<n; j++) { std::cin >> a; std::cin >> b; std::cin >> c; is += (a * b); want += (a * c); } if(is == want) { std::cout << "TAK"; } else { std::cout << "NIE"; } } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <iostream> int main(int argc, const char * argv[]) { int t, n, a, b, c; long is, want; std::cin >> t; for (int i =0; i<t; i++) { std::cin >> n; is = 0; want = 0; for (int j =0; j<n; j++) { std::cin >> a; std::cin >> b; std::cin >> c; is += (a * b); want += (a * c); } if(is == want) { std::cout << "TAK"; } else { std::cout << "NIE"; } } return 0; } |