#include <iostream>
using namespace std;
int main(){
int Z;
cin>>Z;
while(Z--){
int n;
cin>>n;
int tempP=0;
int tempW=0;
for(int i=0; i<n; i++){
int obj, tp, tw;
cin>>obj>>tp>>tw;
tempP+=obj*tp;
tempW+=obj*tw;
}
if(tempP==tempW)
cout<<"TAK"<<endl;
else
cout<<"NIE"<<endl;
}
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 | #include <iostream> using namespace std; int main(){ int Z; cin>>Z; while(Z--){ int n; cin>>n; int tempP=0; int tempW=0; for(int i=0; i<n; i++){ int obj, tp, tw; cin>>obj>>tp>>tw; tempP+=obj*tp; tempW+=obj*tw; } if(tempP==tempW) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; } return 0; } |
English