UVA 初学者题目
来源:互联网 发布:什么电脑壁纸软件好 编辑:程序博客网 时间:2024/05/19 10:37
原题:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=996
Problem A
Hashmat the brave warrior
Input: standard input
Output: standard output
Hashmat is a brave warrior who with his group of young soldiers moves from one place to another to fight against his opponents. Before fighting he just calculates one thing, the difference between his soldier number and the opponent's soldier number. From this difference he decides whether to fight or not. Hashmat's soldier number is never greater than his opponent.
Input
The input contains two integer numbers in every line. These two numbers in each line denotes the number of soldiers in Hashmat's army and his opponent's army or vice versa. The input numbers are not greater than 2^32. Input is terminated by End of File.
Output
For each line of input, print the difference of number of soldiers between Hashmat's army and his opponent's army. Each output should be in seperate line.
Sample Input:
10 1210 14
100 200
Sample Output:
24
100
#include <stdio.h>/*author:Yangsirtime:2014/5/7*/int main(){long long a,b;while(~scanf("%lld%lld",&a,&b))printf("%lld\n",a>b?a-b:b-a);return 0;}原题:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=1012
Problem B
Back to High School Physics
Input: standard input
Output: standard output
A particle has initial velocity and constant acceleration. If its velocity after certain time is v then what will its displacement be in twice of that time?
Input
The input will contain two integers in each line. Each line makes one set of input. These two integers denote the value of v (-100 <= v <= 100) and t(0<=t<= 200) ( t means at the time the particle gains that velocity)
Output
For each line of input print a single integer in one line denoting the displacement in double of that time.
Sample Input
0 05 12
Sample Output
0120
#include <stdio.h>/*author:Yangsirtime:2014/5/7*/int main(){int v,t;while(~scanf("%d%d",&v,&t))printf("%d\n",2*v*t);return 0;}
原题:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=1241
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
#include <stdio.h>/*author:YangSirtime:2014/5/7*/int main(){int n,f,i,a,b,c,sum;while (~scanf("%d",&n)){while(n--){scanf("%d", &f);sum=0;for (i=0;i<f;i++){scanf("%d%d%d",&a,&b,&c);sum+=a*c;}printf("%d\n",sum);}}return 0;}
- UVA 初学者题目
- c语言初学者题目
- uva题目分类
- UVA dp题目汇总
- UVA 题目401 - Palindromes
- Uva题目401总结
- UVA题目分类
- UVa推荐题目
- UVA题目分类索引
- UVA 题目难度 分级
- UVA 1664(思路题目)
- UVA题目分类
- uva题目笔记
- 题目来源UVA
- uva题目做题记录
- uva 题目难度分级列表
- uva题目难度分级列表
- UVA 题目11729 - Commando War
- 指针与数组(一)
- ios存储之plist
- 以字符方式显示4位数字的年份
- 华为编程大赛,笨笨熊搬家,OJ平台网络问题提交不上代码。先将代码到这。
- 关于剪贴板和Unicode —— CLIPTEXT程序分析
- UVA 初学者题目
- Android设置全屏时出现unfortunately Activity has stopped,app不能运行
- ADO.NET数据库的连接(SQL数据库的连接)
- 动态链接库导出函数示例
- Java随笔
- 【菜鸟学WCF】以IIS为宿主创建WCF服务及问题解决
- 《算法导论》笔记 第24章 总结与思考
- 最长单调子序列种类数
- android获取屏幕分辨率