上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 38 下一页
摘要: 刚开始,做了水题#include #include #include using namespace std;int main(){ int n; int a31,a32,a41,a42,a121,a122,ans3,ans4,ans12; while(scanf("%d",&n)!=EOF){ ... 阅读全文
posted @ 2014-08-27 09:38 chenjunjie1994 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 直接枚举就可以了。#include #include #include #include using namespace std;int a,b;vector ans;int main(){ while(scanf("%d%d",&a,&b)!=EOF){ if(a==0&&b==0) break... 阅读全文
posted @ 2014-08-27 09:25 chenjunjie1994 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 最小生成树#include #include #include #include #include using namespace std;const int Maxn=110;struct Pex{ double x,y,z; double r;};Pex pt[Maxn];int n;doubl... 阅读全文
posted @ 2014-08-26 20:20 chenjunjie1994 阅读(159) 评论(0) 推荐(0) 编辑
摘要: DLX的题,做过这题才算是会吧。这道题转化成了精确覆盖模型来做,一开始,只是单纯的要覆盖完行列和斜线,WA。后来醒悟了,不能这样,只要覆盖全部行或列即可。虽然如此,但某些细节地方很关键不能考虑到。特别要注意的是for(int i=R[c];i;i=R[i]){ if(i>ne) break; if(... 阅读全文
posted @ 2014-08-26 19:38 chenjunjie1994 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 精确覆盖#include #include #include #include #include using namespace std;const int maxn=920;const int maxnode=920*550;const int maxr=550;int ans;struct DL... 阅读全文
posted @ 2014-08-26 09:23 chenjunjie1994 阅读(232) 评论(0) 推荐(0) 编辑
摘要: WA了好久,第一次用重覆盖的模型做题。感觉这题有个陷阱,那就是当去掉某些边后,若因为这个边去掉而被破环的正方形还存在,那么就会造成覆盖不完全,WA.所以,在去掉边后,必定有些正方形是不存在的,须重新计算。另外,计算一个正方形有哪些边也很困难。#include #include #include #i... 阅读全文
posted @ 2014-08-26 00:03 chenjunjie1994 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 同上题#include #include #include #include #include #include using namespace std;int puzzle[10][10];char tmp[100];const int SLOT=0;const int ROW=1;const i... 阅读全文
posted @ 2014-08-25 11:14 chenjunjie1994 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 9阶数独,如上题做#include #include #include #include #include #include using namespace std;int puzzle[10][10];char tmp[15];const int SLOT=0;const int ROW=1;co... 阅读全文
posted @ 2014-08-25 10:41 chenjunjie1994 阅读(148) 评论(0) 推荐(0) 编辑
摘要: DLX算法,刚接触,是关于精确覆盖的,白书上有算法介绍。代码模板#include #include #include #include #include #include using namespace std;char puzzle[20][20];const int SLOT=0;const i... 阅读全文
posted @ 2014-08-25 09:57 chenjunjie1994 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 简单DP题。可以用运算符重载来写,简单一些。#include #include #include #include using namespace std;class STRS{public: char str[100]; void operator=(STRS b){ strcpy(str,b.... 阅读全文
posted @ 2014-08-23 11:28 chenjunjie1994 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 二维树状数组可解此题#include #include #include #include #define lowbit(x) (x)&(-x)using namespace std;int sum[105][105],k,n,m;int W,H;void gp(int x,int y){ int ... 阅读全文
posted @ 2014-08-23 10:10 chenjunjie1994 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 模拟退火算法。。。。这道题,呃。我怎么感觉他就是随机的。同一个代码,时而AC,时而WA。其实还真的是随机的。呵呵呵呵呵。。。因为下降火太快了,没办法,而降得慢又会。。。TLE,虽然精度提高了。敢问,还有什么好的方法?我是在做退火算法时遇到这个练手的。#include #include #includ... 阅读全文
posted @ 2014-08-12 16:14 chenjunjie1994 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 模拟退火算法。随机MAX个点,然后,退火移动,选取距离所有点中最短中最长者即可。理解和我上一篇一样。#include #include #include #include #include #include using namespace std;const int MAXN=1010;const ... 阅读全文
posted @ 2014-08-12 11:19 chenjunjie1994 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 模拟退火算法。昨天看了PPT,原来模拟退火算法涉及到马尔什么链,开始理解,它其实就是一个关于抽样的问题。随机抽样,选取足够多的样本,然后逐步逼近。而在平面上,由于T的下降,使得逐渐缩小至一点。然后,就可以了。算法:在平面上随机选取一些点,当然这些点应当有一点相关的性吧。我猜的。然后在这些点随机移动,... 阅读全文
posted @ 2014-08-12 09:27 chenjunjie1994 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 基本小圆覆盖模板题#include #include #include using namespace std;int X,Y; int n;const double eps=0.00000001;struct point{ double x,y;}p[550]; struct Circle{... 阅读全文
posted @ 2014-08-11 11:52 chenjunjie1994 阅读(302) 评论(0) 推荐(0) 编辑
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 38 下一页