The Third Cup is Free Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1811    Accepted Submission(s): 846 Problem Description Panda and his friends were hiking in the forest. They came across…
其实就是求总长度 - 一个最长“连续”自序列的长度 最长“连续”自序列即一个最长的lis,并且这个lis的值刚好是连续的,比如4,5,6... 遍历一遍,贪心就是了 遍历到第i个时,此时值为a[i],如果a[i]-1在前面已经出现过了,则len[a[i]] = len[a[i-1]]+1 否则len[a[i]] = 1 #include <cstdio> #include <algorithm> #include <cstring> #include <iostr…
New Year is coming, and Jaehyun decided to read many books during 2015, unlike this year. He has n books numbered by integers from 1 to n. The weight of the i-th (1 ≤ i ≤ n) book is wi. As Jaehyun's house is not large enough to have a bookshelf, he k…
有一家生产酸奶的公司,连续n周,每周需要出货numi的单位,已经知道每一周生产单位酸奶的价格ci,并且,酸奶可以提前生产,但是存储费用是一周一单位s费用,问最少的花费. 对于要出货的酸奶,要不这一周生产,要不提前生产. 什么时候采用什么生产方式呢? 若第i周的货提前生产的话,假设在j周生产,则费用为(i-j)*s+c[j] 若c[i]>(i-j)*s+c[j],则更新c[i]=(i-j)*s+c[j] 更新要O(n^2)? 可以证明,最优的生产方式是,要不在这一周生产,要不在上一周生产(这里的上…
题目 /** * compareTo:根据该数值是小于.等于.或大于 val 返回 -1.0 或 1: public int compareTo(BigInteger val) 将此 BigInteger 与指定的 BigInteger 进行比较. 对于针对六个布尔比较运算符 (<, ==, >, >=, !=, <=) 中的每一个运算符的各个方法,优先提供此方法. 执行这些比较的建议语句是:(x.compareTo(y) <op> 0), 其中 <op>…
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 22742    Accepted Submission(s): 9865 Problem Description Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 ==…
Error Correction Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6825   Accepted: 4289 Description A boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which are set…
传送门 简单题 #include<bits/stdc++.h> using namespace std; struct node { double dan,weight; }a[]; bool cmp(node x,node y) { return x.dan<y.dan; } void init() { ;i<;i++) { a[i].dan=0.0;a[i].weight=0.0; } } int main() { int c; while(~scanf("%d&qu…
Buildings Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 185    Accepted Submission(s): 25 Problem Description Your current task is to make a ground plan for a residential building located i…
pid=5288">http://acm.hdu.edu.cn/showproblem.php?pid=5288 Problem Description OO has got a array A of size n ,defined a function f(l,r) represent the number of i (l<=i<=r) , that there's no j(l<=j<=r,j<>i) satisfy ai mod aj=0,now…