【Codeforces 4D】Mysterious Present】的更多相关文章

[链接] 我是链接,点我呀:) [题意] 要求长度和宽度都严格递增(选择一个序列) 然后你一开始有一个长度和宽度 要求这个一开始所给的长度和宽度能接在你选择的一段连续的长度宽度的开头 (且保持原来的性质) 问你这个最长序列是什么.并打印 [题解] 将信件按照w,h两个关键字分别上升的顺序排序 然后做个dp f[i]表示以i作为开头能够得到的最长序列长度 并标记它下一个转移到了哪里 f[i] = max{f[j]+1} w[i]<w[j] && h[i]<h[j] [代码] im…
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 其实就是让你最后这n个数字的和最大. 加上的x没有关系.因为肯定都是加上n个x 所以直接加上就可以了 主要在于如何选取j 显然我们要找到一个位置j. 然后pre[j]+aft[j]的值最大(pre[j]=1+2+3+...+j-1,aft类似 (这是在d大于0的时候,小于0的时候找pre[j]+aft[j]最小的就好) [代码] #include <bits/stdc++.h> #define ll long long using na…
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=2000),问满足[数列长度是k && 数列中每一个元素arr[i]在1~n之间 && 数列中元素可以重复]的数列有多少个?结果对10^9+7取余 解题思路:dp[i][j]表示长度是j,最后一位是i的种数 if(kk%i==0) dp[kk][j+1]+=dp[i][j] #inc…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Alyona's mother wants to present an array of n non-negative integers to Alyona. The array should be special. Alyona is a capricious girl so afte…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art. The main…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expe…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Bogdan has a birthday today and mom gave him a tree consisting of n vertecies. For every edge of the tree i, some number xi was written on it. I…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Wilbur is playing with a set of n points on the coordinate plane. All points have non-negative integer coordinates. Moreover, if some point (x,…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Young Timofey has a birthday today! He got kit of n cubes as a birthday present from his parents. Every cube has a number ai, which is written on…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical…