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;
阅读全文
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
阅读全文