coder_new

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

2012年5月8日

摘要: DFS+状态位View Code 1 #include<iostream> 2 using namespace std; 3 4 int chess=0; 5 int step; 6 bool flag=false; 7 int ri[16],cj[16]; 8 9 bool isopen(void)10 {11 if(chess==0xFFFF)12 return true;13 else14 return false;15 }16 17 void flip(int bit)18 {19... 阅读全文
posted @ 2012-05-08 11:44 coder_new 阅读(154) 评论(0) 推荐(0) 编辑

2012年5月7日

摘要: 枚举#include <iostream>using namespace std;void flip(int* a,int i){ int row,col; row=i/4+1; col=i%4+1; a[i]=1-a[i]; for(int j=0;j<4;j++) { a[j+4*(row-1)]=1-a[j+4*(row-1)]; a[4*j+col-1]=1-a[4*j+col-1]; }}bool check(int* a){ int sum=0; for(int i=0;i<16;i++) { ... 阅读全文
posted @ 2012-05-07 19:27 coder_new 阅读(301) 评论(1) 推荐(0) 编辑

摘要: DFSDFS#include<iostream>using namespace std;bool map[6][6],flag=0;int dir[5][2]={{0,0},{0,1},{1,0},{-1,0},{0,-1}};int step;void flip(int row,int col){ for(int i=0;i<5;i++) { int x=row+dir[i][0]; int y=col+dir[i][1]; map[x][y]=!map[x][y]; }}bool check(){ int i,j; f... 阅读全文
posted @ 2012-05-07 10:46 coder_new 阅读(180) 评论(0) 推荐(0) 编辑

2012年5月3日

摘要: 枚举法参考点灯游戏枚举#include <iostream>using namespace std;void flip(int* a,int i){ a[i]=1-a[i]; if(i>3) a[i-4]=1-a[i-4]; if(i<12) a[i+4]=1-a[i+4]; if(i%4!=0) a[i-1]=1-a[i-1]; if((i+1)%4!=0) a[i+1]=1-a[i+1];}bool check(int* a){ int sum=0; for(int i=0;i<16;i++) { sum+=a[i]; }... 阅读全文
posted @ 2012-05-03 17:12 coder_new 阅读(229) 评论(0) 推荐(0) 编辑

2012年4月24日

摘要: OJ上的一些水题(可用来练手和增加自信)(poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法: (1)图的深度优先遍历和广度优先遍历. (2)最短路径算法(dijkstra,bellman-for 阅读全文
posted @ 2012-04-24 10:44 coder_new 阅读(151) 评论(0) 推荐(0) 编辑

摘要: DescriptionPerhaps you have heard of the legend of the Tower of Babylon. Nowadays many details of this tale have been forgotten. So now, in line with the educational nature of this contest, we will tell you the whole story: The babylonians had n types of blocks, and an unlimited supply of blocks of 阅读全文
posted @ 2012-04-24 10:27 coder_new 阅读(442) 评论(0) 推荐(0) 编辑