Problem DescriptionIgnatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一个.现在给你城堡的地图,请你计算出Ignatius能否在魔王回来前离开城堡(只要走到出口就算离开城堡,如果走到出口的时候魔王刚好回来也算逃亡成功),如果可以请输出需要多少分钟才能离开,如果不能则输出-1 Read More
posted @ 2013-06-10 21:07 瓶哥 Views(211) Comments(0) Diggs(0) Edit
Problem DescriptionIgnatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial exploding time of the bomb is set to 6 minutes. To prevent the bomb from explodin Read More
posted @ 2013-06-10 21:06 瓶哥 Views(187) Comments(0) Diggs(0) Edit
1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 #include <windows.h> 5 #define STACK_INIT_SIZE 20 6 #define STACKINCREMENT 10 7 8 typedef char ElemType; 9 typedef struct10 {11 ElemType *top;12 ElemType *base;13 int stacksize; 14 }sqStack;15 16 //创建一个栈 17 void Read More
posted @ 2013-06-10 14:26 瓶哥 Views(196) Comments(0) Diggs(0) Edit
1 #include <cstdio> 2 #include <conio.h> 3 #include <windows.h> 4 #define MaxSize 10 5 typedef int ElemType; //把int定义为ElemType 6 typedef struct 7 { 8 int *elem; 9 int length;10 int listsize; 11 }Sqlist;12 13 void initSqlist(Sqlist *L)14 {15 L->elem=(int*)malloc(MaxSize*sizeof(El Read More
posted @ 2013-06-10 14:25 瓶哥 Views(166) Comments(0) Diggs(0) Edit
1 #include <cstdio> 2 #include <windows.h> 3 #define MaxSize 10 4 void insertElem(int Sqlist[],int *len,int i,int x) 5 { 6 int t; 7 if(*len==MaxSize || i<1 || i>*len+1) //检测非法插入 8 { 9 printf("This insert is illegal\n");10 return; 11 }12 for(t=*len-1;t>... Read More
posted @ 2013-06-10 14:24 瓶哥 Views(110) Comments(0) Diggs(0) Edit