UVa-Ecological Premium
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; }
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; }