题目链接:http://lightoj.com/volume_showproblem.php?problem=1102 As I am fond of making easier problems, I discovered a problem. Actually, the problem and k=. There are solutions. They are . . . . . . . . . . . . . . . As I have already told you that I us…
1102 - Problem Makes Problem As I am fond of making easier problems, I discovered a problem. Actually, the problem is 'how can you make n by adding k non-negative integers?' I think a small example will make things clear. Suppose n=4and k=3. There ar…
题目链接:http://acm.hust.edu.cn/vjudge/contest/121396#problem/F http://lightoj.com/volume_showproblem.php?problem=1004 密码:acm 分析:求从上往下路径的最大权值.   解题思路:数字三角形的变形,把菱形分为上下两部分求即可.dp[i][j]表示路径到第i行第j个点的最大权值和.     *: 上:dp[i][j]=max(dp[i-1][j], dp[i-1][j-1])+maps[…
1102 - Problem Makes Problem As I am fond of making easier problems, I discovered a problem. Actually, the problem is 'how can you make n by adding k non-negative integers?' I think a small example will make things clear. Suppose n=4 and k=3. There a…
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1060 题解:如果是不重复数的这些操作可以用康托展开的逆来求,如果是有重复数字出现康托展开的逆就要稍微变一下.要除去自身个数的组合数具体看一代码,暴力就行 #include <iostream> #include <cstring> #include <cstdio> using namespace std; typedef long long ll;…
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1134 题解:简单的一道组合题,现求一下前缀和,然后只要找前缀和膜m的结果相同的值相互组合就行. #include <iostream> #include <cstring> #include <cstdio> using namespace std; typedef long long ll; ; ll a[M] , sum[M] , num[M];…
链接: https://vjudge.net/problem/LightOJ-1102 题意: As I am fond of making easier problems, I discovered a problem. Actually, the problem is 'how can you make n by adding k non-negative integers?' I think a small example will make things clear. Suppose n…
Mike and Geometry Problem 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/I Description Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1…
计算机技术已运用到人类生活的方方面面,帮助人类解决各种问题.可你是否有想过,计算机是否能为人类解决所有问题呢? 假如你是一个程序猿,你已编写过很多程序.有些程序一下子就能出结果,有些程序则好久都没有显示结果.你不知道这些程序到底最终是否会显示结果.你突然灵光一现---“能不能设计一个程序,用于检测任意程序最终会停止运行还是会无限运行下去”.这样,你就不用为了得到程序的结果而等很久,有时甚至还无法确定到底是不是程序本身出现了问题,导致程序无限循环. 说干就干,你为这一想法设计的思路如下: 定义一个…
http://www.lightoj.com/volume_showproblem.php?problem=1070 思路:\({(a+b)}^n =(a+b){(a+b)}^{n-1} \) \((ab)C_{n}^{r}a^{n-r}b{r} = C_{n+2}^{r}a^{n-r+2}b{r} - a^{n+2} - b^{n+2} \) 综上\( f(n) = (a+b)f(n-1)-(ab)f(n-2) \) /** @Date : 2016-12-19-19.53 * @Author…