I tried to submit my source code of the problem 10300 - Ecological Premium and i got the messenge Time limit exceeded. The run time was 3.00 seconds but the Time limited is 1.00 second, i`ve tried to simplify the algorithm but i failed. I don`t know what i can do. pls Help me.
Source Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int n, f, i, j, sum, space, animals, C;
while (n!=EOF){
scanf ("%d", &n);
for( i=0; i<n; i++){
scanf("%d", &f);
sum=0;
for (j=0; j<f; j++){
scanf("%d%d%d", &space, &animals, &C);
sum+=space*C;
}
printf("%d\n", sum);
}
}
return 0;
}
