Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17653    Accepted Submission(s): 7902 Problem Description We all know that Bin-Laden is a notorious terrorist, and he h…
多校10 1002 HDU 6172 Array Challenge 题意 There's an array that is generated by following rule. \(h_0=2,h_1=3,h_2=6,h_n=4h_{n-1}+17h_{n-2}-12h_{n-3}-16\) And let us define two arrays bnandan as below. $ b_n=3h_{n+1} h_n+9h_{n+1} h_{n-1}+9h_n^2+27h_n h_{n…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2147 题目大意:给你一个n*m的棋盘,初始位置为(1,m),两人轮流操作,每次只能向下,左,左下这三个方向移动,谁最后无法移动棋子就输掉比赛,问先手是否会获胜. 解题思路:简单题,P/N分析找规律,以(n,m)点为结束点推到起始点,如图: 发现每个田字格的状态都是一样的,因为(n,m)点一定时P态,所以可以得出规律:只有当(m%2==1&&n%2==1)时,先手才会输. 代码: #includ…
Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13861    Accepted Submission(s): 6230 Problem Description We all know that Bin-Laden is a notorious terrorist, and he…
Problem Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported that he hides in Hang Zhou of China! "Oh, God! How terrible! " Don't be so afraid, guys. Although he hi…
题意: 有面值分别为1.2.5的硬币,分别有num_1.num_2.num_5个,问不能组成的最小面值是多少?(0<=每种硬币个数<=1000,组成的面值>0) 思路: 母函数解决.只有3个括号要作乘法,分别代表面值1.2.5所能组成的情况.需要两个数组,所能组成的最大值为num_1+2*num_2+5*num_5.如果在这个范围内都能组成,那么最小不能组成的面值为num_1+2*num_2+5*num_5+1.若没有1分钱的硬币,那么不能组成的肯定是1了. 数组的用法:ans[]保存第…
//给你面值为1,2,5的三种硬币固定的数目,求不能凑出的最小钱数 //G(x)=(1+x+...+x^num1)(1+x^2+...+x^2num2)(1+x^5+,,,+x^5num3), //展开,系数不为0的数都是能够由硬币组合出来的. # include <algorithm> # include <string.h> # include <stdio.h> # include <iostream> using namespace std; int…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1085 解题报告:有1,2,5三种面值的硬币,这三种硬币的数量分别是num_1,num_2,num_5,问你不能凑的钱的最小值是多少. DP,开一个这样的数组dp[i][3],然后dp[i][0]表示凑成 i 元钱需要dp[i][0]张1块的,需要dp[i][1]张两块的,dp[i][2]张5块的,然后依次往后递推,得到 i 的途径一共有三种,第一种是i-1加一张一块的,第二种是i-2加上1张两块的,…
Problem Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported that he hides in Hang Zhou of China! “Oh, God! How terrible! ” Don’t be so afraid, guys. Although he hides i…
生成函数题. 题意:有币值1,2,5的硬币若干,问你最小的不能组成的币值为多少. 解法:写出生成函数: 然后求每项的系数即可. 因为三种硬币最多1000枚,1*1000+2*1000+5*1000=8000,那么多项式乘积的最高次数为8000 用c保存累计相乘各项的系数,tc保存c和当前项相乘的系数 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> us…