只要把所有農夫各自的農場面積和環境等級相乘之後再求總和即是解答。
C++(0.008)
/*******************************************************/
/* UVa 10300 Ecological Premium */
/* Author: Maplewing [at] knightzone.studio */
/* Version: 2011/12/04 */
/*******************************************************/
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int n, f, area, animal, eco, money;
while( scanf( "%d", &n ) != EOF ){
for( int i = 0 ; i < n ; i++ ){
money = 0;
scanf( "%d", &f );
for( int j = 0 ; j < f ; j++ ){
scanf( "%d%d%d", &area, &animal, &eco );
money += area * eco;
}
printf( "%d\n", money );
}
}
return 0;
}