- 博客(20)
- 收藏
- 关注
转载 2386 Lake counting
#include #include #include #include using namespace std; int n,m; int map[110][110],visit[110][110]; int cou,fi,fj; int dir[16] = {0,1,0,-1,1,0,-1,0,1,1,1,-1,-1,1,-1,-1}; int find() { for(int i=1
2014-12-07 11:57:05
423
转载 poj 2002
#include #include #define N 1000 struct Point { int x; int y; }; struct Point point[N]; int n; /* 点的个数 */ /* 由于点已经按照坐标排序过,所以采用二分查找 * 搜索点(x,y)是否存在,存在返回1,否则返回0 */ int bsearch(int x, int y) {
2014-12-07 11:44:50
534
原创 poj 2698
八皇后问题 原题大意就是棋盘上有八个皇后,但是这八个不能再一直线出现,求各个皇后能够个不伤害的排法 #include #include #define max 8 int sum=0,queen[max]; void print() { int i,j; printf("NO:%d\n",++sum); for(i=0;i<max;i++) {
2014-11-30 14:11:16
602
原创 heu acm基础训练之1002
hanoi塔: 原题大意我就不说明了,大家懂得 #include void move(int n,char x,char y) { printf("move %d from %c to %c\n",n,x,y); } int hanoi(int n,char x,char y,char z) { if(n==1) move(1,x,z); else { hanoi(n-1,x,z,y); mo
2014-11-30 14:05:30
732
原创 heu acm基础训练 1001
哈尔滨工程大学 online judge acm训练之分治算法 原题大意:求a ,b,之间的数有多少个1,包括a,b. 这题典型的分治算法; 举例说明: 以197为例: 那么我们将其分为个位,十位,个位7上有一个,那么在190~197上有7+1个 然后整十位上的为18,即197/10-1,然后其权值将变为10。如此进行。 源代码: #include #define N 11 i
2014-11-30 13:40:35
851
原创 poj百练 2694
#include#include#include#includetypedef struct stacknode{char stack[100];int top;}Stack;double cal(char op,double a,double b){switch(op){case '*':return a*b;break;case '/':return b/a;break;ca
2014-11-02 13:57:58
639
原创 poj 3038
#includeint main(){int n,m,i,j,k,min,max=0;char data[101][51];int flag[101]={0};int len[101]={0};scanf("%d%d",&n,&m);for(i=0;im;i++){scanf("%s",&data[i]);for(j=0;jn;j++)for(k=j+1;kn;k++)if(da
2014-10-26 14:40:59
727
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅