随笔分类 -  HDU 11版

 
HDU 2089
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2089基础的数位dp,当初不懂数位dp水过去的,今天重新写一下,解释看注释预处理+递推学自http://wenku.baidu.com/view/9de41d51168884868662d623.html#include using namespace std ;int f[8][10] ;//f[i][j]表示第i位是数j时符合条件的数字数量 int digit[9] ;//digit[i]表示n从右到左第i位是多少 void Init(){ f[0][0]=1 ; for(int i=1 ;... 阅读全文
posted @ 2013-12-13 17:37 LegendaryAC 阅读(2422) 评论(5) 推荐(0)
HDU 2065 "红色病毒"问题
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2065dp转移方程:dp[i][1]=2*dp[i-1][1]+dp[i-1][2]+dp[i-1][3];dp[i][2]=dp[i-1][1]+2*dp[i-1][2]+dp[i-1][4];dp[i][3]=... 阅读全文
posted @ 2012-08-06 10:34 LegendaryAC 阅读(441) 评论(0) 推荐(0)
HDU 2063 过山车
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2063二分图最大匹配,参照白书上邻接表建的图View Code #include #include const int MAX1=501;const int MAX2=1001;int k,m,n;int matc... 阅读全文
posted @ 2012-05-20 15:56 LegendaryAC 阅读(120) 评论(0) 推荐(0)
HDU 2066 一个人的旅行
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2066裸最短路,一开始又sb了,处理错复杂度TLE,囧View Code #include #include const int INF=1000000001;const int maxn=1001;int G[m... 阅读全文
posted @ 2012-05-13 22:57 LegendaryAC 阅读(258) 评论(0) 推荐(0)
HDU 2086 A1=?
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2086找规律,自己推公式。View Code #include <stdio.h>int main(){ int n,i; double a0,a1,n1,a[5000]; while(~scanf("%d",&n)) { scanf("%lf%lf",&a0,&n1); for(i=0;i<n;i++) scanf("%lf",&a[i]); a1=n*a0+n1; for(i=1;i<=n; 阅读全文
posted @ 2011-12-30 18:41 LegendaryAC 阅读(308) 评论(0) 推荐(0)
HDU 2067 小兔的棋盘
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2067这道题的状态我很久以前就分析过了,是一道递推题,当初感觉思维很乱没写出来。今天好好研究了一下动态规划,发现用动态规划中记忆化搜索的思想能解决此问题。View Code #include <stdio.h>#include <string.h>int n,flag=1; __int64 d[100][100]; __int64 f(int i,int j) { if(d[i][j]>=1)return d[i][j]; if(j==1)return d[i][j]=i; if 阅读全文
posted @ 2011-12-27 21:52 LegendaryAC 阅读(210) 评论(0) 推荐(0)