2012年1月8日 星期日

acm 10300 Ecological Premium

[心得]  0.004

1.double 要用lf

#include <stdio.h>
int main()
{
  int i,counter,data; 
  double award,answer[21];
  counter=0;
  scanf("%d",&data);
 
  while(data)
  { 
    double a,b,c;
    int famer;
    data--;
    award=0;
  
             
    scanf("%d\n",&famer);
    for(i=0;i<famer;i++)
    {
                    
       scanf("%lf %lf %lf",&a,&b,&c);
       award = award+a*c;                
    }  
    answer[counter]= award;
    counter++;                  
                         
  }   
    for(i=0;i<counter;i++)
      printf("%.0f\n",answer[i]);
   system("pause");
   //return 0;
}

沒有留言:

張貼留言