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)

 #include <stdio.h>
int main()
{
#ifdef CLOCK
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
int n,i,f,j,sum = ;
int input[];
scanf("%d", &n);
for (i = ; i < n; i++)
{
if (n < )
scanf("%d", &f);
if (f > && f < )
for (j = ; j < f; j++)
{
scanf("%d%d%d", &input[], &input[], &input[]);
sum += (input[] * input[]);
}
printf("%d\n", sum);
sum = ;
}
return ;
}

报告:还是一轮AC,不过用了重定向,以前没发现重定向非常方便去测验,傻傻的一直慢慢输,不过题目还真是一知半解,baidu后才知道大概,英语有待加强。

问题:无

解决:无

UVa OJ 10300的更多相关文章

  1. uva oj 567 - Risk(Floyd算法)

    /* 一张有20个顶点的图上. 依次输入每个点与哪些点直接相连. 并且多次询问两点间,最短需要经过几条路才能从一点到达另一点. bfs 水过 */ #include<iostream> # ...

  2. UVa OJ 194 - Triangle (三角形)

    Time limit: 30.000 seconds限时30.000秒 Problem问题 A triangle is a basic shape of planar geometry. It con ...

  3. UVa OJ 175 - Keywords (关键字)

    Time limit: 3.000 seconds限时3.000秒 Problem问题 Many researchers are faced with an ever increasing numbe ...

  4. UVa OJ 197 - Cube (立方体)

    Time limit: 30.000 seconds限时30.000秒 Problem问题 There was once a 3 by 3 by 3 cube built of 27 smaller ...

  5. UVa OJ 180 - Eeny Meeny

    Time limit: 3.000 seconds限时3.000秒 Problem问题 In darkest <name of continent/island deleted to preve ...

  6. UVa OJ 140 - Bandwidth (带宽)

    Time limit: 3.000 seconds限时3.000秒 Problem问题 Given a graph (V,E) where V is a set of nodes and E is a ...

  7. 548 - Tree (UVa OJ)

    Tree You are to determine the value of the leaf node in a given binary tree that is the terminal nod ...

  8. UVa OJ 10071

    Problem B Back to High School Physics Input: standard input Output: standard output A particle has i ...

  9. UVa OJ 10055

    Problem A Hashmat the brave warrior Input: standard input Output: standard output Hashmat is a brave ...

随机推荐

  1. MBR所在位置

    如果offset的000000000位置如下图所示(主要看红色框框位置是否出现NTFS字样),说明系统文件是NTFS "EB 52"至"55 AA"位置是MBR ...

  2. 将UIImage保存成JPG或PNG格式存储在本地

    -(void)pngAndJpg:(UIImage*)image{ NSString *pngPath = [NSHomeDirectory() stringByAppendingPathCompon ...

  3. 如何让windows服务器IIS支持.apk/.ipa文件下载

    打开IIS服务管理器,找到服务器,右键-属性,打开IIS服务属性: 单击MIME类型下的“MIME类型”按钮,打开MIME类型设置窗口: 单击“新建”,建立新的MIME类型: 扩展名是:.apk MI ...

  4. android AsyncHttpClient 开源框架的使用

    AsyncHttpClient 1.在很多时候android都需要进行网络的操作,而android自带的HttpClient可以实现,但要进行很多网络连接的时候(如:下载很多图片),就需要线程池来进行 ...

  5. Jupyter增加内核

    本例的Jupyter安装在Python3下,以增加Python2内核为例. 首先确认在Python3下已安装了内核: ipython kernel install --user #or python3 ...

  6. mysql 清除数据库数据

    select Concat('TRUNCATE TABLE ', TABLE_NAME, ';') from INFORMATION_SCHEMA.TABLES

  7. HTML第九天学习笔记

    今天就继续看了下浮点float属性,代码如下: <html> <head> <title>CSS float属性</title> <meta ht ...

  8. Flex4 DataGrid ItemRenderer内嵌方式

    Flex4 DataGrid ItemRenderer像Flex3一直内嵌ItemRenderer会报空对象引用的错误,如: <s:GridColumn dataField="titl ...

  9. Hex-Rays decompiler type definitions and convenience macros

    /****************************************************************************************** Copyrigh ...

  10. MON166 User's Guide

    MON166 is a debug monitor for C16x and ST10 user programs. It consists of: A configurable monitor pr ...