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的更多相关文章

  1. UVa 10300 - Ecological Premium

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

  2. Ecological Premium - UVa10300

    欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/uva10300.html 题目描述 Pr ...

  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. 【索引】Volume 0. Getting Started

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

  7. UVa OJ 10300

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

  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. 基于物联网技术和RFID电子客票的铁路自己主动检票机

    前言: RFID电子客票具有检阅速度快.信息量大.安全性高和高速物理定位的独特优势,随着标准的统一和成本的减少,它在铁路上有着巨大的应用前景,同一时候鉴于车站对物联网化的需求,我们设想出新一代的检票机 ...

  2. 检测到有潜在危险的Request.Form值

    由于在.net中,Request时出现有HTML或Javascript等字符串时,系统会认为是危险性值.立马报出“从客户端 中检测到有潜在危险的Request.Form值”这样的错. 用encodeU ...

  3. jquerymobile知识点:select的动态帮定

    代码: <div data-role="navbar"> <ul> <li> <select name="select-choi ...

  4. 偷偷mark下一个

    java书单 thinking in java java战 Effective Java 深入了解JVM虚拟机 java性能优化权威指南 JSR133 Google Guava官方教程 版权声明:本文 ...

  5. Linux系统调优1

    Linux在进行系统调优的时候,首先要考虑整个操作系统的结构,然后针对各个部分进行优化,下面展示一个Linux系统的各个组成部分: 有上图可以看出,我们可以调整的有应用程序,库文件,内核,驱动,还有硬 ...

  6. 浅谈Android自定义锁屏页的发车姿势

    一.为什么需要自定义锁屏页 锁屏作为一种黑白屏时代就存在的手机功能,至今仍发挥着巨大作用,特别是触屏时代的到来,锁屏的功用被发挥到了极致.多少人曾经在无聊的时候每隔几分钟划开锁屏再关上,孜孜不倦,其酸 ...

  7. ubuntu常用文件搜索命令 分类: linux 学习笔记 ubuntu 2015-07-05 15:40 84人阅读 评论(0) 收藏

    1.find find [搜索路径] [搜索关键字] 比如查找/test中文件名为t5.tmp的文件: 查找根目录下大于100M的文件 注意,这里的204800单位是块,1块=512字节 在根目录下查 ...

  8. JavaScript的DOM操作(二)

    一:window.history对象 历史记录,通过历史记录可以操作页面前进或者后退 window.history.back();后退 window.history.forward();前进 wind ...

  9. Android-关于屏幕适配的一些经验

    刚开始,我开发时选取的模拟器是WVGA854,其分辨率为854*480.我开发完毕后装在800*480的手机上时感觉很OK,但是装到480*320.以及320*240分辨率上的手机时,很多界面都变形了 ...

  10. HDU-1012(水题)

    http://acm.hdu.edu.cn/showproblem.php?pid=1012 分析:就按题目给的公式一步步输出就行了. #include<stdio.h> #include ...