蜡笔的涂鸦
t0uch · 共 47 篇文章
四阶幻方 v1.1 向2064ms进发
改进了一下程序,在我的p4 3.2上以2064ms运算完7040个 到此告一段落,880的版本不想写了,麻烦,研究一下五阶的,好像好复杂。371993326789901217467999448150835200000000个组合,呼呼。 开头的两个include 是iostream 和time.h,万恶的代码显示器 cpp 代码 #include #include using namespace std; struct uni { int a,b,c,d; }; uni can[3000]; int sum = 0,sum_all = 0; void get_all_num() { for(…
2007-08-24 17:14 · C · 评论(1)
四阶幻方
我写的四阶幻方出来了,运行结果正确,7040个的版本。虽然好像还有些问题,不过算了,能跑就可以了,呵呵。 不要输出的话我的p4 3.2G上耗时5s,算还过得去吧 ^_^ 以下是程序: cpp 代码 #include <iostream></iostream> #include <time.h></time.h> using namespace std; struct uni { int a,b,c,d; }; uni can[2065]; long sum = 0; int sum_all = 0; void get_all_num() { for(int i = 1;i <= 16;++i…
2007-08-23 15:59 · 评论(0)