赵乐ACM

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年4月24日

摘要: 1. 第一次做位运算的题,参考了这段经典代码(n皇后问题):void Queen(int row, int ld, int rd) { int pos, p; int upperlim = (1 > 1); } } else ++sum; }2. 以下是代码:/* ID: dollar4 PROG: checker LANG: C++ */ #include #include #include #include #include #include #include using namespace std; ofstream fou... 阅读全文
posted @ 2012-04-24 16:24 赵乐ACM 阅读(177) 评论(0) 推荐(0) 编辑

摘要: 1.从数学的角度: 1.首位只能是质数2 3 5 72.其余位只能是1,3,7,93.若n=1,直接输出2,3,5 7直接DFS 1~9,加入当前数末尾,并判断是不是素数,是则递归处理下一位数,不是则回溯,直到depth>n。不会超时。2. 这道题折磨了我好久,一直出现Execution error: Your program (`sprime') exited with signal #11 (segmentation violation [maybe caused by accessing memory out of bounds, array indexing out of 阅读全文
posted @ 2012-04-24 16:19 赵乐ACM 阅读(195) 评论(0) 推荐(0) 编辑