摘要: 思路:用map将每个字符串与一个数字进行对应,然后暴力统计就好了#include#include#include#include#include#include#include#include#define Maxn 2010using namespace std;int fr[Maxn][Maxn],mul[Maxn][Maxn],Max[Maxn];char str[Maxn][20];map g;vector head[Maxn*2];vector ans[Maxn*2];int cmp(int a,int b){ return strcmp(str[a],str[b])<0;}i 阅读全文
posted @ 2013-08-22 19:02 fangguo 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 思路:dp[i][x][y]表示第i个序列中,右脚在x位置,左脚在y位置时,其最小花费。那么dp[i][x][y]=min(dp[i-1][a[i]][y]+cost[a[i]][x],dp[i-1][x][a[i]]+cost[a[i]][y]);题目连接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=32#include#include#include#include#include#include#incl 阅读全文
posted @ 2013-08-22 18:51 fangguo 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 思路:黑书的例题#include#include#include#include#include#define Maxn 20#define mul(a) ((a)*(a))using namespace std;int dp[16][9][9][9][9];int s[10][10],val[10][10];int S(int x1,int y1,int x2,int y2){ return mul(s[x2][y2]-s[x2][y1-1]-s[x1-1][y2]+s[x1-1][y1-1]);}int main(){ int n,m,i,j; double avg; ... 阅读全文
posted @ 2013-08-22 08:54 fangguo 阅读(176) 评论(0) 推荐(0) 编辑