UVa OJ 10300
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的更多相关文章
- uva oj 567 - Risk(Floyd算法)
/* 一张有20个顶点的图上. 依次输入每个点与哪些点直接相连. 并且多次询问两点间,最短需要经过几条路才能从一点到达另一点. bfs 水过 */ #include<iostream> # ...
- UVa OJ 194 - Triangle (三角形)
Time limit: 30.000 seconds限时30.000秒 Problem问题 A triangle is a basic shape of planar geometry. It con ...
- UVa OJ 175 - Keywords (关键字)
Time limit: 3.000 seconds限时3.000秒 Problem问题 Many researchers are faced with an ever increasing numbe ...
- 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 ...
- UVa OJ 180 - Eeny Meeny
Time limit: 3.000 seconds限时3.000秒 Problem问题 In darkest <name of continent/island deleted to preve ...
- 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 ...
- 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 ...
- UVa OJ 10071
Problem B Back to High School Physics Input: standard input Output: standard output A particle has i ...
- UVa OJ 10055
Problem A Hashmat the brave warrior Input: standard input Output: standard output Hashmat is a brave ...
随机推荐
- rapsbian下配置ngrok
访问https://ngrok.com,下载Linux/ARM版本的(因为PI为ARM的芯片,如果下载Linux版本的是无法正常使用的) 解压 $ unzip /path/to/ngrok.zip 注 ...
- C# 多线程参数的使用
一个参数: Thread.Start方法可以带一个参数: public static void Main() { Thread t = new Thread(new ParameterizedThre ...
- 利用UIImagePickerController或者利用UIKit的 UIGraphicsBeginImageContext保存图片
转载自:http://my.oschina.net/hmj/blog/99970 应用中有时我们会有保存图片的需求,如利用UIImagePickerController用IOS设备内置的相机拍照 ...
- [转]前景检测算法--ViBe算法
原文:http://blog.csdn.net/zouxy09/article/details/9622285 转自:http://blog.csdn.net/app_12062011/article ...
- 《面向对象程序设计》第二次作业(1)(A+B问题)
作业记录: 问题描述与代码已上传github仓库object-oriented文件夹下 题目一览 Calculate a + b and output the sum in standard form ...
- commondline 之二 执行类
E:\cn\zno\commandline\Test.class package cn.zno.commandline; import java.lang.management.ManagementF ...
- AFNetworking 与 NSURLSession
转载自:http://blog.sina.com.cn/s/blog_8157560c0101kt7h.html 1. 也就是说在IOS 7.1 之后你想用网络请求的话有两种途径,NSUrlSessi ...
- 查找DOM
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- openNebula Image上传
Rack:ruby webserver框架 https://rack.github.io/ 文件上传使用基于tempfile 库 文件上传要经历两个过程: 1.上传文件传到opennebule sun ...
- matlab reshape函数
语法 (1)B = reshape(A,m,n) 使用方法: B=reshape(A,m,n) 返回m*n矩阵B,它的元素是获得A的行宽度.假设A没有m*n元素,得到一个错误结果. 样例: <s ...