#include <iostream>
#include <cstdio>
using namespace std;
int main(){
long long r, a, b, c, t, f, i, h;
while(scanf("%lld", &t) == 1){
for(h = 1; h <= t; h++){
r = 0;
scanf("%lld", &f);
for(i = 1; i <= f; i++){
scanf("%lld %lld %lld", &a, &b, &c);
r += (a * c);
}
printf("%lld\n", r);
}
}
return 0;
}
#include <cstdio>
using namespace std;
int main(){
long long r, a, b, c, t, f, i, h;
while(scanf("%lld", &t) == 1){
for(h = 1; h <= t; h++){
r = 0;
scanf("%lld", &f);
for(i = 1; i <= f; i++){
scanf("%lld %lld %lld", &a, &b, &c);
r += (a * c);
}
printf("%lld\n", r);
}
}
return 0;
}
No comments:
Post a Comment