10300 - Ecological Premium
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)
注:每块土地的三个参数:x , y , z。
x代表这块土地所占空间;
y代表这块土地上的动物数;
z代表这块土地的经济效益;
根据题意:每只动物所需支付的金钱为:x/y*z;
即所有动物所需金钱为:x/y*z*y=x*z;
代码:
#include "stdio.h" int main()
{
long long sum,x,y,z;
int n,f;
scanf("%d",&n);
while(n--)
{
sum=;
scanf("%d",&f);
while(f--)
{
scanf("%lld %lld %lld",&x,&y,&z);
sum=sum+x*z;
}
printf("%lld\n",sum);
}
return ;
}
10300 - Ecological Premium的更多相关文章
- UVa 10300 - Ecological Premium
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...
- Ecological Premium - UVa10300
欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/uva10300.html 题目描述 Pr ...
- Ecological Premium
#include<bits/stdc++.h> using namespace std; int main() { int n,m; unsigned long long int a,b, ...
- 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 ...
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- 【索引】Volume 0. Getting Started
AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 0. Getting Started 10055 - Hashmat the Brav ...
- UVa OJ 10300
Problem A Ecological Premium Input: standard input Output: standard output Time Limit: 1 second Memo ...
- 数据库管理工具GUI - PremiumSoft Navicat Premium Enterprise 11.2.15 x86/x64 KEY
转载自: 数据库管理工具GUI - PremiumSoft Navicat Premium Enterprise 11.2.15 x86/x64 KEY Navicat Premium(数据库管理工具 ...
- mysql 5.7 的安装配置与 navicat premium for mysql 11 的破解使用
再安装mysql5.7 或以上的版本出现了一些问题,现在总结下,希望能给初入学习mysql的人一下帮助,大牛就不要来嘲笑小弟我了 首先准备如下: 1.下载mysql 5.7,下载地址:https:// ...
随机推荐
- cocos2d-x 事件分发机制 ——加速计事件监听
加速计事件监听机制 在上一篇中介绍了cocos2d-x中的触摸事件机制,这篇来介绍下游戏中也常常常使用到的加速计事件,这些都是游戏中的常常要用到的. 移动设备上一个非常重要的输入源是设备的方向.大多数 ...
- Python介绍、环境搭建(Eclipse插件)、第一个程序
Python介绍 特点 优雅.明白.简单. 适合领域 1. Web站点和各种网络服务 2. 系统工具和脚本 3. 作为"胶水"语言把其它语言开发的模块包装起来方便使用 和其它语言对 ...
- GDB 调试程序系列
http://blog.csdn.net/haoel/article/category/9197
- Qss All
/* * OOMidi application style sheet */QFrame#transportToolButtons{border: 0;spacing: 0;margin: 0;pad ...
- (转载)equals与==
引言:从一个朋友的blog转过来的,里面解决了两个困扰我很久的问题.很有久旱逢甘霖的感觉. 概述: A.==可用于基本类型和引用类型:当用于基本类型时候,是比较值是否相同:当用于引用类型 ...
- eclipse快速查找一个变量、方法或者类被引用的地方
最近不停debug,拿到一个变量之后总是要先概览一下才好下手,之前一直用Ctrl+F来做,太麻烦.今天查了下eclipse使用,发现有快捷键,使用方法: 先双击要查看的变量.方法或者类,使之被选中,然 ...
- 在iis中mantisbt配置过程
最近需要安装个mantisbt,由于不想再安装个apache服务器,因此直接使用iis作为php解析服务器.同时为了方便管理安装包,将php安装包和扩展包能够独立存放在D:\Program Files ...
- jwPlayer实现支持IE8及以下版本避免出错的方法
jwplayer在支持Html5的情况下会自动使用html5的video和audio标签进行播放视频和音频.但是在IE中版本低于IE9时 <script src="jwplayer.h ...
- eclipse同时开两个tomcat
首先设置环境变量: 接着修改其中一个tomcat下bin文件夹的startup.bat和catalina.bat 将里面所有CATALINA_HOME都修改为CATALINA_HOME2 然后 修改c ...
- ui-router的使用
使用时需要ui中用ui-view指令指定 如: <div ui-view></div> 首先配置注册 ui-route var mainModule = angular.mod ...