八数码问题。BFS+康托展开
很经典的题。问你怎么移动恢复到初始状态。
一开始上下左右的方向搞错了,而且因为是多种答案(Special Judge)所以WA了好几次,于是一步一步打印出来。终于对了。
跑了360ms。ORZ 0ms的大神。 交HDU 的 1070 就无限TLE 。继续优化好了。(自认为自己的逆康托展开写得不好)
#include
#inclu...
分类:
其他好文 时间:
2014-09-11 11:19:01
阅读次数:
270
Chinese Knot
Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge
Chinese knot is a decorative handicraft that began as a form of Chinese folk artifact in the Tang and Song Dynas...
分类:
其他好文 时间:
2014-09-10 09:40:50
阅读次数:
304
Cat
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768
K (Java/Others)
Total Submission(s): 451 Accepted Submission(s): 100
Special Judge
Problem Description
There is ...
分类:
其他好文 时间:
2014-09-09 13:06:08
阅读次数:
557
We Need Medicine
Time Limit: 10 Seconds Memory Limit: 65536 KB Special Judge
A terrible disease broke out! The disease was caused by a new type of virus, which will lead to lethal lymp...
分类:
其他好文 时间:
2014-09-09 12:55:12
阅读次数:
301
A Volcanic Island
Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge
An underwater volcano has erupted massively in somewhere of the deep Atlantis Ocean. This large eruption le...
分类:
其他好文 时间:
2014-09-09 12:53:58
阅读次数:
137
Easter Holidays
Time Limit: 1 Second Memory Limit: 32768 KB Special Judge
Scandinavians often make vacation during the Easter holidays in the largest ski resort Are. Are provides fan...
分类:
其他好文 时间:
2014-09-04 22:21:58
阅读次数:
275
我该怎么说这道题呢。。。说简单其实也简单,就枚举模拟,开始卡了好久,今天看到这题没a又写了遍,看似会超时的代码交上去a了,果然实践是检验真理的唯一标准。。。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const i...
分类:
其他好文 时间:
2014-09-01 19:12:43
阅读次数:
190
//给出n和k,求k个不同的正整数,使其中k-1个数能组成平方数,k个数的和为n。有解输出YES,无解输出NO。
# include
# include
# include
# include
using namespace std;
int n,k;
bool judge(int num)
{
int yy=num*num;//k-1个数相加
int kk=n-yy;
...
分类:
其他好文 时间:
2014-09-01 15:36:43
阅读次数:
171
其实就是筛选素数。如,若能被2是质数,则2的倍数全是合数。如此循环。#include #include #include #include #include using namespace std;const int Max=(1<<24);bool prime[Max+10];bool judge...
分类:
其他好文 时间:
2014-08-27 20:27:38
阅读次数:
191