hdoj 5461 Largest Point】的更多相关文章

Largest Point Time Limit: 1500/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 702    Accepted Submission(s): 293 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5461 题意:给三个数n,a,b,接下来给出n个数的数列,从数列中找到ti和tj使a*ti*ti+…
Largest Point Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5461 Description Given the sequence A with n integers t1,t2,⋯,tn. Given the integral coefficients a and b. The fact that select two elements ti and tj…
Thinking about it: 对于式子 a * ti * ti + b * tj,可以看作时有两部分构成 a * ti * ti 和 b * tj,如果整个式子要最大,则要求这两部分都要尽量大.那么再读入数据 t 时,那么就可以构造两个数组,一个存储a * ti * ti ,另一个存储 b * tj.在选取时就产生了两种方案: 1. 先选取 a * ti * ti 最大的,接着再 i != j 的基础上, 选择 b * tj 最大的. 2. 先选取 b * tj 最大的,接着再 i !=…
$ 2019 $ 暑期刷题记录: $ POJ~1952~~BUY~LOW, BUY~LOWER: $ (复杂度优化) 题目大意:统计可重序列中最长上升子序列的方案数. 题目很直接的说明了所求为 $ LIS $ 的方案数 但是题目给出的元素是会重复的,结果需要去重 用 $ n^2 $ 的动态规划再另建数组记录方案可以秒杀 如果要优化复杂度就必须用求 $ LIS $ 的 $ nlogn $ 算法,其中树状数组符合要求 $ POJ~1934~~Trip: $ (方案输出) 题目大意:输出两个序列中最长…
Problem Description Everybody knows any number can be combined by the prime number. Now, your task is telling me what position of the largest prime factor. The position of prime 2 is 1, prime 3 is 2, and prime 5 is 3, etc. Specially, LPF(1) = 0. Inpu…
题目;http://acm.hdu.edu.cn/showproblem.php?pid=5461 题意就是在数组中找出a*t[i]*t[i]+b*t[j]的最大值,特别注意的是这里i和i不能相等,想不到的是居然直接暴力排序都能过,而且这题的数据很水,好多有bug的代码都能过 但是我们要对自己要求严一点,尽量吧各种情况考虑到位,如果下面的代码还有不妥,欢迎指正 #include<cstdio> #include<cmath> #include<algorithm> us…
Largest Point Time Limit: 1500/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 1102    Accepted Submission(s): 429 Problem Description Given the sequence A with n integers t1,t2,⋯,tn. Given the integral coeffic…
Twitter还是Amazon拿这个题目当过面试题.DP区间求面积. /* 1506 */ #include <cstdio> #include <cstring> #include <cstdlib> #define MAXN 100005 #define INF 999999 int l[MAXN], r[MAXN]; __int64 a[MAXN]; __int64 max(__int64 a, __int64 b) { return a>b ? a:b;…
HDOJ 1238 Substrings [最长公共子串] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11430 Accepted Submission(s): 5490 Problem Description You are given a number of case-sensitive strings of alphabetic…
Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330. Note: The result may be very large, so you need to return a string instead of an i…