上一页 1 ··· 4 5 6 7 8
2013年7月25日

25号搜索的一些例子,。。Oil Deposits&&Red and Black&&Knight Moves&&Catch That Cow&&Tempter of the Bone

摘要: Oil Depositshttp://poj.org/problem?id=1562一个简单又基础的搜索题目: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 char a[105][105]; 7 int s=0,i,j,x,y;“有多个函数,应把变量定义在外面”深搜 8 void dfs(int i,int j) 9 {10 if(ix||jy||a[i][j]!='@')11 return ;//直接跳出来.12 ... 阅读全文
posted @ 2013-07-25 23:27 ~~碾压机 阅读(254) 评论(1) 推荐(0) 编辑

第一次超水(我错了,有难度的)的组队赛!!!The Coco-Cola Store &&Multiple of 17&& Box Game

摘要: The Coco-Cola StoreOnce upon a time, there is a special coco-cola store. If you return three empty bottles to the shop, you'll get a full bottle of coco-cola to drink. If you have n empty bottles right in your hand, how many full bottles of coco-cola can you drink?InputThere will be at most 10 t 阅读全文
posted @ 2013-07-25 22:14 ~~碾压机 阅读(316) 评论(0) 推荐(0) 编辑
2013年7月24日

博弈 7月24号:HDU 2176(Nim博弈)

摘要: HDU 2176(Nim博弈)Problem Descriptionm堆石子,两人轮流取.只能在1堆中取.取完者胜.先取者负输出No.先取者胜输出Yes,然后输出怎样取子.例如5堆 5,7,8,9,10先取者胜,先取者第1次取时可以从有8个的那一堆取走7个剩下1个,也可以从有9个的中那一堆取走9个剩下0个,也可以从有10个的中那一堆取走7个剩下3个.Input输入有多组.每组第1行是m,m 2 using namespace std; 3 4 const int N = 200002; 5 6 int n, a[N]; 7 8 void So... 阅读全文
posted @ 2013-07-24 23:43 ~~碾压机 阅读(233) 评论(0) 推荐(0) 编辑

2013年7月23号:大数的加与乘I-number&&Power of Cryptography

摘要: 这个问题需要对字符与整数的来回转变要非常熟悉,不然一下转不过弯来!!!当看到题目给的值的取值范围很大时,一般想到大数的加减乘除: I-numberhttp://acm.hdu.edu.cn/showproblem.php?pid=4608不解释,只要看到这个The length of x will not exceed 105.就知道了 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int main() 7 { 8 char a[200005]... 阅读全文
posted @ 2013-07-24 14:54 ~~碾压机 阅读(177) 评论(0) 推荐(0) 编辑
2013年7月23日

2013年7月20号: Flip Game&&The Pilots Brothers' refrigerator&&Coin Change&&Discrete Function&&Football Gambling II

摘要: Flip Gamehttp://acm.tzc.edu.cn/acmhome/problemdetail.do?method=showdetail&id=3248实实在在的深搜问题,注意几点:关于这类问题,最好变成0和1来回的切换(简洁,清晰)思路的话,因为深搜这是第一题,也是最难懂的,所以多看看,多想想。 1 #include 2 #include 3 #include 4 using namespace std; 5 int a[4][4]; 6 int flag=0,step; 7 int range(... 阅读全文
posted @ 2013-07-23 17:09 ~~碾压机 阅读(134) 评论(0) 推荐(0) 编辑

贪心算法小结。今年暑假不AC&&Radar Installation&&Y2K Accounting Bug&&Minimal Coverage

摘要: 今年暑假不AC:http://acm.hdu.edu.cn/showproblem.php?pid=2037一个简单的贪心例题:思路:就是自己看: 1 #include 2 3 using namespace std; 4 5 int main() 6 7 { 8 9 int a[100],b[100]; 10 11 int n; 12 13 int e=0; 14 15 int cont=0; 16 17 ... 阅读全文
posted @ 2013-07-23 14:26 ~~碾压机 阅读(204) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8