摘要:
题目链接思路很简单。。。但是细节啊。。。。WA了好多次。。。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <string> 5 #include <ctime> 6 #include <cstdlib> 7 using namespace std; 8 int p[10001]; 9 int dp1[10],dp2[10],o[3];10 int main()11 {12 int i,j,n,k;13 scanf(" 阅读全文
posted @ 2013-03-12 22:01
Naix_x
阅读(271)
评论(0)
推荐(0)
摘要:
这个题 第一问应该可以想出,第二问以前也做过类似的贪心,两问组合起来,就是理解不来题意,不知如何下手了,看题解后,唉。。。第一问有点DP思想,第二问求max(cosa[i] + cosb[n-i+1])。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: job 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <string>10 using namespace std;11 #define INF 0x7ffffff 阅读全文
posted @ 2013-03-12 16:44
Naix_x
阅读(259)
评论(0)
推荐(0)
摘要:
题目链接对数位DP,不太熟,组合的方法可能更好想,实现把所有的情况都考虑清楚。例如算1的个数的时候。假如第一位为n > 1,第一位可能为0-n-1,后面len-1位中1的和有(sum = (len-1)*10^(len-2))(枚举每一位是1,其他位置有10种可能);这样还要注意第一位是1,这样有10^(len-1)个1;第一位是n,继续递归下去。假如第一位为0,直接递归下去。假如第一位为1情况,为sum + (后边数字+1(有0))+dfs(str+1);二的情况与一类似,认真分析各种情况。 1 #include <cstdio> 2 #include <cstrin 阅读全文
posted @ 2013-03-12 13:26
Naix_x
阅读(833)
评论(0)
推荐(0)

浙公网安备 33010602011771号