HDU5595
来源:互联网 发布:域名转出申请表 编辑:程序博客网 时间:2024/04/30 00:45
GTW likes math
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 251 Accepted Submission(s): 124
Problem Description
After attending the class given by Jin Longyu, who is a specially-graded teacher of Mathematics, GTW started to solve problems in a book titled “From Independent Recruitment to Olympiad”. Nevertheless, there are too many problems in the book yet GTW had a sheer number of things to do, such as dawdling away his time with his young girl. Thus, he asked you to solve these problems.
In each problem, you will be given a function whose form is likef(x)=ax2+bx+c . Your assignment is to find the maximum value and the minimum value in the integer domain[l,r] .
In each problem, you will be given a function whose form is like
Input
The first line of the input file is an integer T , indicating the number of test cases. (T≤1000 )
In the followingT lines, each line indicates a test case, containing 5 integers, a,b,c,l,r . (|a|,|b|,|c|≤100,|l|≤|r|≤100 ), whose meanings are given above.
In the following
Output
In each line of the output file, there should be exactly two integers,max and min , indicating the maximum value and the minimum value of the given function in the integer domain[l,r] , respectively, of the test case respectively.
Sample Input
11 1 1 1 3
Sample Output
13 3Hint$f_1=3,f_2=7,f_3=13,max=13,min=3$#include<stdio.h>int main(){ int a,b,c,l,r; int n; int i; int ma,ni,Max,Min;scanf("%d",&n); while(n--) {Max=-10000000;Min=10000000; scanf("%d%d%d%d%d",&a,&b,&c,&l,&r); for(i=l;i<=r;i++) { ma=a*i*i+b*i+c; if(ma>=Max) Max=ma; if(ma<=Min) Min=ma; } printf("%d %d\n",Max,Min); } return 0;}
0 0
- HDU5595
- HDU5595:GTW likes math
- HDU5595(水题+数学)
- BestCoder Round #66 (div.2)1001 GTW likes math HDU5595
- POJ 2262 筛素法
- ARRAYLIST VECTOR LINKEDLIST 区别与用法
- 有关网页抓取的内容
- unity C#模板
- Hadoop伪分布集群安装
- HDU5595
- 如何安全退出已调用多个Activity的Application?
- SQL * Loader详解
- linux Cent OS6.5 安装nodeJS(分分钟搞定)
- 手把手入门神经网络系列(2)_74行代码实现手写数字识别
- 5个不同的数比较7次解析
- AndroidHttp通信 HTTP Client与HttpURLConnection的区别
- 服务器接受客户端图片
- 基于PCA简单的人脸识别opencv实现-图像处理学习笔记