代码:
#include <stdio.h>
const int MAXN = 20;
int main( )
{
int a,i,j;
scanf("%d",&a);
for ( i = 0; i < a; i++){
int b,sum = 0,p[MAXN][MAXN];
scanf("%d",&b);
for ( j = 0; j < b; j++){
scanf("%d%d%d",&p[j][0],&p[j][1],&p[j][2]);
sum += p[j][0]*p[j][2];
}
printf("%d\n",sum);
}
return 0;
}
小结:
1. 第一次return 0: 没加 runtime error,第二次过了
2.看题目花了很长时间,英语太烂了,特别是这句话,意思没理解,This line is followed by one line per farmer containing three positive integers each: the size of the farmyard in square meters, 其实就是 第一个数字这个农民有多大地方,我硬是将 in square meters 理解成 每平方米有多大地方,当时就糊涂了
3 看题目不急,慢慢看