摘要:
1 #include<bits/stdc++.h> 2 using namespace std; 3 int sublater(char *s){ 4 int i,j,k,t; 5 int n=strlen(s); 6 printf("###\n"); 7 for( i=0 , j=1 ; j<n 阅读全文
摘要:
朴素的回文串做法1: 1 #include<bits/stdc++.h> 2 using namespace std; 3 string longestPailndrome(string &s){ 4 int Len = s.size(); //字符串长度 5 int MaxLen = 1; //最 阅读全文
摘要:
【题目链接】 http://acm.hdu.edu.cn/showproblem.php?pid=6719 在本题中,我们只有两种方法计算两个的矩阵的乘积,第一种为定义法,需要次乘法和次加法。第二种为Strassen分治法,仅当为偶数时可以使用,需要次加法以及再计算次大小为的矩阵的乘积。这次更小矩阵 阅读全文
摘要:
【P1464 Function】 【题解】 按照题目意思进行递归即可,但是过程中需要用到记忆化搜索。 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 ll dp[50][50][50]; 5 ll 阅读全文
摘要:
【P3817 小A的糖果 小A有N个糖果盒,第i个盒中有a[i]颗糖果。 小A每次可以从其中一盒糖果中吃掉一颗,他想知道,要让任意两个相邻的盒子中加起来都只有x颗或以下的糖果,至少得吃掉几颗糖。 【贪心策略】: 因为吃后面的可以影响后面的情况。所以一旦不满足就吃后面的即可。 1 #include<b 阅读全文