摘要: 我认为这题更像一道数学题,找规律的,1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ...就是要找到这些数之间的规律,a[i]=max(a[s1]*2,max(a[s2]*3,max(a[s3]*5,a[s4]*7)));就是输出格式有点麻烦。代码: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<iostream> 5 using namespace st 阅读全文
posted @ 2011-11-30 21:40 Misty_1 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 这就是一道简单的DP题,唯一的麻烦在于他要求输出起始点和终止点,用一个数组来存放起始点就OK了。代码: 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 int main() 5 { 6 int a[100010],f[100010]; 7 int t,n,i,j,m,x,y; 8 scanf("%d",&t); 9 for(i=1;i<=t;i++)10 {11 scanf("%d",&n);12 for(j=1;j& 阅读全文
posted @ 2011-11-30 21:34 Misty_1 阅读(175) 评论(0) 推荐(0) 编辑