2012年8月31日
摘要: 大意:给你一张棋盘,给你一定的棋子,空白区域不能放,问最多可能有几种方法。思路:典型的搜索题目。CODE:#include<stdio.h>#include<stdlib.h>#include<string.h>usingnamespacestd;constintSIZE=80;intv[SIZE];charmaze[SIZE][SIZE];intn,k;intcnt;voiddfs(intr,intnum){if(num==k){cnt++;return;}if(r>n)return;for(inti=0;i<n;i++){if(!v[i]&a 阅读全文
posted @ 2012-08-31 15:21 有间博客 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 大意:通过货币的兑换去套利,若能套利则输出Yes,否则输出No。思路:通过Floyd算法算出的d[i][i]即每种货币能不能套利,只要存在一种则输出Yes。数据的处理通过STL中的map容器去处理。CODE:#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<map>usingnamespacestd;constintSIZE=34;doubled[SIZE][SIZE];map<string,int>hash; //ma 阅读全文
posted @ 2012-08-31 11:02 有间博客 阅读(258) 评论(0) 推荐(0) 编辑