Advertisement
juanjo12x

UVA_10300_Ecological_Problem

Jun 3rd, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main(int argc, char** argv) {
  6.     int t,metres,nanim,deg,nfarm,i,j,suma;
  7.     while(scanf("%d",&t)==1){/*read number of test cases*/
  8.        
  9.         for(i=0;i<t;i++){
  10.         suma=0;
  11.         scanf("%d",&nfarm);/*number of farmers*/
  12.          for(j=0;j<nfarm;j++){
  13.             scanf("%d %d %d",&metres,&nanim,&deg);
  14.             suma=suma+(metres*deg);
  15.          }
  16.          printf("%d\n",suma);
  17.         }
  18.        
  19.     }
  20.     return (EXIT_SUCCESS);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement