题目地址:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=15&problem=1241&mosmsg=Submission+received+with+ID+12041586
C++代码:
#include <iostream> using namespace std; int main() { int a,b,c; int n,f; while(cin>>n) { while(n--) { cin>>f; int sum=0; while(f--) { cin>>a>>b>>c; sum+=a*c; } cout<<sum<<endl; } } return 0; }