BestCoder Round #66 (div.2)1001 GTW likes math HDU5595
2015-12-18 22:02
281 查看
GTW likes math
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072K (Java/Others)
Total Submission(s): 498 Accepted Submission(s): 254
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 like f(x)=ax2+bx+c.
Your assignment is to find the maximum value and the minimum value in the integer domain [l,r].
Input
The first line of the input file is an integer T,
indicating the number of test cases. (T≤1000)
In the following T 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.
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
1 1 1 1 1 3
Sample Output
13 3 Hint$f_1=3,f_2=7,f_3=13,max=13,min=3$
Source
BestCoder Round #66 (div.2)
出题人:由于是整数区间,直接枚举即可。时间复杂度O(T*(r-l))O(T∗(r−l))
相关文章推荐
- python的数与字符串
- checkio-house password
- 应修改selinux参数导致Kernel panic -not syncing:Attempted to kill init
- Ubuntu 14.04下chromium怎样设置支持flash
- [LeetCode136]Single Number寻找一个数组里只出现一次的数
- 使用sysbench进行压力测试
- Strtoul command
- 使用DBUtils反射虚拟实体(实际数据库没有相对应的表)
- zabbix监控nginx 状态
- thinkPHP3.2.2使用thinkSDK实现第三方登录(以QQ登录)为例。
- poj 2391 二分 拆点 最大值最小值网络流
- CCNP学习笔记11-BGP 13条选路
- 为什么需要ndk
- Heroku创始人Adam Wiggins发布十二要素应用宣言
- checkio-medium
- HackerRank Largest Rectangle
- 8、深入理解Looper、Handler、Message
- mac 搭建 内网微信服务 ngrok
- 20151218--地区导航习题
- Android网络请求