#include<cstdio>
int main()
{
int t;
scanf("%d", &t);
while(t--) {
int n,l,a,b;
scanf("%d", &n);
long long x=0,y=0;
for (int i=0; i<n; i++) {
scanf("%d%d%d",&l,&a,&b);
x += l*a, y += l*b;
}
printf(x == y ? "TAK" : "NIE");
}
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include<cstdio> int main() { int t; scanf("%d", &t); while(t--) { int n,l,a,b; scanf("%d", &n); long long x=0,y=0; for (int i=0; i<n; i++) { scanf("%d%d%d",&l,&a,&b); x += l*a, y += l*b; } printf(x == y ? "TAK" : "NIE"); } return 0; } |
English