摘要: 题目大意:在一个国际象棋盘上放置皇后,使得目标全部被占领,求最少的皇后个数。题目分析:迭代加深搜索,否则超时。小技巧:用vis[0][r]、vis[1][c]、vis[2][r+c]、vis[c-r+N]分别标志(r,c)位置相对应的行、列、主、副对角线有没有被占领(详见《入门经典(第2版)》P19... 阅读全文
posted @ 2015-09-20 22:31 20143605 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 题目大意:经典的埃及分数问题。代码如下:# include# include# include# includeusing namespace std;# define LL long longint num[5],a,b,k;LL ans[10000],v[10000];LL gcd(LL a,L... 阅读全文
posted @ 2015-09-20 20:59 20143605 阅读(390) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionGiven the sequence A with n integers t1,t2,⋯,tn. Given the integral coefficients a and b. The fact that select two elements ti and ... 阅读全文
posted @ 2015-09-20 09:46 20143605 阅读(198) 评论(0) 推荐(0) 编辑