欢迎访问我的新博客:http://www.milkcu.com/blog/

原文地址:http://www.milkcu.com/blog/archives/uva10300.html

题目描述

Problem A

Ecological Premium

Input: standard input

Output: standard output

Time Limit: 1 second

Memory Limit: 32 MB

German farmers are given a premium depending on the conditions at their farmyard. Imagine the following simplified regulation: you know the size of each farmer's farmyard in square meters and the number of animals living at it. We won't make a difference
between different animals, although this is far from reality. Moreover you have information about the degree the farmer uses environment-friendly equipment and practices, expressed in a single integer greater than zero. The amount of money a farmer receives
can be calculated from these parameters as follows. First you need the space a single animal occupies at an average. This value (in square meters) is then multiplied by the parameter that stands for the farmer's environment-friendliness, resulting in the premium
a farmer is paid per animal he owns. To compute the final premium of a farmer just multiply this premium per animal with the number of animals the farmer owns.

Input

The first line of input contains a single positive integer n (<20), the number of test cases. Each test case starts with a line containing a single integer f (0<f<20), the number of farmers in the test case. This line is
followed by one line per farmer containing three positive integers each: the size of the farmyard in square meters, the number of animals he owns and the integer value that expresses the farmer’s environment-friendliness. Input is terminated by end of file.
No integer in the input is greater than 100000 or less than 0.

Output

For each test case output one line containing a single integer that holds the summed burden for Germany's budget, which will always be a whole number. Do not output any blank lines.

Sample Input

3
5
1 1 1
2 2 2
3 3 3
2 3 4
8 9 2
3
9 1 8
6 12 1
8 1 1
3
10 30 40
9 8 5
100 1000 70

Sample Output

38

86

7445


(The Joint Effort Contest, Problem setter: Frank Hutter)

解题思路

已知农场的面积和动物的数目。

此外还知道农场主使用设备的环境友好等级。

农场主得到的奖金可以由上面三个参数计算得出。

首先获得每只动物平均占用的面积。

然后这个值乘以环境友好度参数,得到的是一只动物得到的奖金。

最后把上面的值乘以动物的数目,就可以得到农场主获得的奖金。



奖金 = 农场的面积 / 动物的数目 * 环境友好等级 * 动物的数目 = 农场的面积 * 环境友好等级 



No integer in the input is greater than 100000 or less than 0.

注意数值范围,需要用long long保存。

代码实现

#include <iostream>
using namespace std;
int main(void) {
int n;
cin >> n;
while(n--) {
int f;
cin >> f;
long long s = 0;
while(f--) {
long long a, b, c;
cin >> a >> b >> c;
s += a * c;
}
cout << s << endl;
}
return 0;
}

(全文完)

Ecological Premium - UVa10300的更多相关文章

  1. 10300 - Ecological Premium

    Problem A Ecological Premium Input: standard input Output: standard output Time Limit: 1 second Memo ...

  2. UVa 10300 - Ecological Premium

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...

  3. Ecological Premium

    #include<bits/stdc++.h> using namespace std; int main() { int n,m; unsigned long long int a,b, ...

  4. UVA_10300:Ecological Premium

    Sample Input 351 1 12 2 23 3 32 3 48 9 239 1 86 12 18 1 1310 30 409 8 5100 1000 70Sample Output 3886 ...

  5. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  6. UVa OJ 10300

    Problem A Ecological Premium Input: standard input Output: standard output Time Limit: 1 second Memo ...

  7. 【索引】Volume 0. Getting Started

    AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 0. Getting Started 10055 - Hashmat the Brav ...

  8. 数据库管理工具GUI - PremiumSoft Navicat Premium Enterprise 11.2.15 x86/x64 KEY

    转载自: 数据库管理工具GUI - PremiumSoft Navicat Premium Enterprise 11.2.15 x86/x64 KEY Navicat Premium(数据库管理工具 ...

  9. mysql 5.7 的安装配置与 navicat premium for mysql 11 的破解使用

    再安装mysql5.7 或以上的版本出现了一些问题,现在总结下,希望能给初入学习mysql的人一下帮助,大牛就不要来嘲笑小弟我了 首先准备如下: 1.下载mysql 5.7,下载地址:https:// ...

随机推荐

  1. Node.js新手教程——怎样实现文件上传功能

    作者:zhanhailiang 日期:2014-11-16 本文将介绍怎样使用Node.js实现文件上传功能. 1. 初始化项目信息:npm init [root@~/wade/nodejs/node ...

  2. Stopwatch计时器、秒表 C#

    .NET2.0也提供了这样一个秒表:Stopwatch类,它可以比较精确地测量时间. 速度测试: 软件的性能和可测性是一个复杂的主题.要确保应用程序能够满足用户的期望,就需要在开发周期内考虑它的性能和 ...

  3. java 选择文件夹对话框

    java swing 选择文件夹对话框 import java.io.File; import javax.swing.JFileChooser; public class Test2 { publi ...

  4. 朴素UNIX之-打开历史

    它可以毫不夸张地说,,UNIX模型是现代操作系统的原型.无论是真实的UNIX让我们大系列AIX,Solaris,HP-UX,FreeBSD,NetBSD,...或类别UNIX实例Linux...或基于 ...

  5. 解决tomcat占用8080端口

    怎么解决tomcat占用8080端口问题图文教程           怎么解决tomcat占用8080端口问题 相信很多朋友都遇到过这样的问题吧,tomcat死机了,重启eclipse之后,发现 Se ...

  6. Ajax得知(两)—— 一个简单的Ajax示例

    通过部分博客认识Ajax之后,我们通过一个简单的实例来消化消化理论知识,一睹Ajax的庐山真面目. 1.实例功能: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZ ...

  7. Java NIO的多路复用及reactor

    (from:http://developer.51cto.com/art/201112/306489.htm) 以下描述,为了说明问题,就提提历史(类似的东西,网上一搜一大把,但是希望你能在这里止步, ...

  8. linux中如何用root去修改其他用户的密码

    linux中如何用root去修改其他用户的密码 昨天linux实验课,我有很多自己想摸索的东西.今天周五,本是下午一二节是编译的实验,可强烈的欲望让我今早就来实验室了,摸索吧,碰到了这个问题....  ...

  9. 深入理解C指针之四:指针和数组

    原文:深入理解C指针之四:指针和数组 数组是C内建的基本数据结构,数组表示法和指针表示法紧密关联.一种常见的错误认识是数组和指针完全可以互换,尽管数组名字有时可以当做指针来用,但数组的名字不是指针.数 ...

  10. EasyUI基础知识Draggable(拖累)

    学习前easyui基于解析器,装载机.对他们来说,入门阶段,我们只需要在一个简单的理解.第一阶段,不宜过深后,.接着,根据easyui订购的文件正在研究安排官方网站Draggable插入. Dragg ...