2007 年文章归档
共 4 篇文章
Rails 2.0.1 Todo List(2.0的scaffold?)
在别处看到的,感觉挺有趣,转一下 rails todo cd todo rake db:create:all(在这之前要把数据库的用户名和密码输入正确) ruby script/generate scaffold Todo title:string body:text done:boolean due:datetime rake db:migrate 开始服务 ruby script/server 打开浏览器输入并访问http://localhost:3000/todos 这是生成的todos_controller.rb class TodosController < Application…
2007-12-17 10:37 · RoR
880版本四阶幻方,我的机器上跑用了34ms
闲来无事,改进改进,多说无益,贴代码,看帖要回帖啊各位 #include < iostream > #include < time.h > using namespace std; struct uni { int a, b, c, d; }; uni can[1032]; const unsigned long punk = 1UL << 2; int sum = 0, sum_all = 0; bool test_4num( int a, int b, int c, int d ) { int i; for ( i = 0;i <= sum;++i ) { if ( can[i].a =…
2007-10-10 10:29 · C
四阶幻方 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
四阶幻方
我写的四阶幻方出来了,运行结果正确,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