ACM UVA 10300 (Ecological Premium)

235阅读 0评论2012-03-23 chnos
分类:C/C++

题目: 

思路: 简单题

代码:

点击(此处)折叠或打开

  1. //
  2. // Author: xfye
  3. // Status: AC
  4. //

  5. #include <iostream>

  6. using namespace std;

  7. int main()
  8. {
  9.     int cases = 0;
  10.     cin >> cases;

  11.     for (int i = 0; i < cases; i++) {
  12.         int farmerNum = 0;
  13.         cin >> farmerNum;
  14.         int result = 0;
  15.         for (int j = 0; j < farmerNum; j++) {
  16.             int yardSize = 0;
  17.             int animalsNum = 0;
  18.             int friendliness = 0;
  19.             cin >> yardSize >> animalsNum >> friendliness;
  20.             result += (yardSize * friendliness);
  21.         }

  22.         cout << result << endl;
  23.     }

  24.     return 0;
  25. }

上一篇:博客已升级,请注意变更地址
下一篇:ACM UVA 10301 (Rings and Glue)