게로샤브쩜넷
          

* * *
 mazr 
2010/12/12 01:13:53, 13182회 읽음 ..written by 윤동희     
  File1 :: 시네마영어2.hwp (49152Byte, 208회 다운)
class MazeDistance {
private static final int maze[][] = {
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 0, 0, 0, 1, 0, 0, 0, 0, 1},
{1, 0, 1, 0, 0, 0, 1, 0, 1, 1},
{1, 0, 0, 0, 1, 0, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 1, 1, 0, 1},
{1, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 1, 1, 1, 0},
{0, 0, 1, 1, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 0, 0, 1, 0, 0, 0, 1},
{0, 0, 0, 0, 1, 1, 0, 1, 0, 0}
};
int start_x, start_y, goal_x, goal_y;
final int row_num = 10, col_num = 10;
private enum status{
Ready, Waiting, Processed
}
     public static void main(String args[]) {
       InputStreamReader r = new InputStreamReader(System.in);
       int distance;
       int maxNum = row_num * col_num;
       int front = 0, rear = 0;
       
          System.out.print("start x : ");
          start_x = r.read();
          System.out.print("start y : ");
          start_y = r.read();
          System.out.print("goal x : ");
          goal_x = r.read();
          System.out.print("goal y :");
          goal_y = r.read();
          
          start = start_x * col_num + start_y;
          goal = goal_x * col_num + goal_y;
          
          int mazeStatus[][] = new int[row_num][col_num];
          
          for(int i = 0; i < row_num; i++){
             for(int j = 0; j < col_numl; j++)
                mazeStatus[i][j] = (int)status.Ready;
          }
          
          int queue[] = new int[maxNum];
          int origin[] = new int[maxNum];
          
          queue[rear] = start;
          origin[rear] = -1;
          rear++;
          
          int cur, left, right, top, down, rightUp, rightDown, leftUp, leftDown;
          
          while(front != rear){
             if(queue[front] == goal)
                break;
             
             cur = queue[front];
             
             left = cur - 1;
             
             if(left >= 0 && left / col_num == cur / col_num){
                if(maze[left / col_num][left % col_num] == 0){
                   if(mazeStatus[left / col_num][left % col_num] == (int)status.Ready){
                      queue[rear] = left;
                      origin[rear] = cur;
                      mazeStatus[left / col_num][left % col_num] = (int)status.Waiting;
                      rear++;
                   }
                }
             }
             
             right = cur + 1;
             if(right < maxNum && right / col_num == cur / col_num){
                if(maze[right / col_num][right % col_num] == 0){
                   if(mazeStatus[right / col_num][right % col_num] == (int)status.Ready){
                      queue[rear] = right;
                      origin[rear] = cur;
                      mazeStatus[right / col_num][right % col_num] = (int)status.Waiting;
                      rear++;
                   }
                }
             }
             
             top = cur - col_num;
             if(top >= 0){
                if(maze[top / col_num][top % col_num] == 0){
                   if(mazeStatus[top / col_num][top % col_num] == (int)status.Ready){
                      queue[rear] = top;
                      origin[rear] = cur;
                      mazeStatus[top / col_num][top % col_num] = (int)status.Waiting;
                      rear++;
                   }
                }
             }
             
             down = cur + col_num;
             if(down < maxNum){
                if(maze[down / col_num][down % col_num] == 0){
                   if(mazeStatus[down / col_num][down % col_num] == (int)status.Ready){
                      queue[rear] = down;
                      origin[rear] = cur;
                      mazeStatus[down / col_num][down % col_num] = (int)status.Waiting;
                      rear++;
                   }
                }
             }
             mazeStatus[cur / col_num][cur / col_num] == (int)status.Processed;
             front++;
                        
          }//while ends
          
          int mazeSolved[][] = new int[row_num][col_num];
          for(int i = 0; i < row_num; i++){
             for(int j = 0; j < col_num; j++)
                mazeSolved[i][j] = maze[i][j];
          }
          
          cur = goal;
          mazeSolved[cur / col_num][cur % col_num] = 9;
          
          for(int i = front; i >= 0; i--){
             if(queuepi[ == cur){
                cur = origin[i];
                if(cur == -1){
                   System.out.println("maze is solved!! distance : " + distance);
                   return distance;
                }
                mazeSolved[cur / col_num][cur % col_num] = 9;
             }
          }
     }
    
     return null;
}
IP : 211.209.173.13
MODIFY IP : 211.209.173.13

2. zexyzefron (2012/01/13 12:34:53) 리플 수정 삭제
1 http://www.tarinthai.com/healthinsurancequotes.html private health insurance >:-[[ http://www.sundayonanism.com/cheap_auto_insurance.html infinity auto insurance :( http://www.theworryfreelife.com/health-insurance-quotes.html health insurance coverage kzc
3. Ippiie (2012/01/15 14:27:34) 리플 수정 삭제
1 http://www.sundayonanism.com/cheap_auto_insurance.html cheap auto insurance 8O http://www.spruceupyourlife.com/cheap-auto-insurance.html nj car insurance 8-OOO http://www.homeinsur.net/ cheap home insurance :-]]
4. lizarBS (2012/01/17 18:18:23) 리플 수정 삭제
1 http://www.wjcrew.org/cheapestlifeinsurance.html life insurance rates jbqxs http://www.sundayonanism.com/cheap_auto_insurance.html car insurance online 8-) http://www.sundayonanism.com/ cheap health insurance >:PPP
5. milaelo (2012/01/21 20:56:00) 리플 수정 삭제
3 http://www.sundayonanism.com/cheap_auto_insurance.html cheap auto insurance 051 http://www.ucsga.com/health_insurance.html health insurance :-[[ http://www.wjcrew.org/ cheapest car insurance fswlkk
6. ziyi07yt (2012/02/21 01:06:08) 리플 수정 삭제
1 http://www.worldofdrugs.net/ discount provigil 858 http://www.pillsprices.com/ what is prednisone used for pmzfmo http://www.pillschoice.com/ colchicine 860444 http://www.painrelieveronline.com/ generic brands for ultram >:((
7. FOXESVERONA (2012/02/24 21:27:24) 리플 수정 삭제
4 http://www.worldofdrugs.net/ provigil >:-((( http://www.medicationsquotes.com/ drugstore colchicine 1546 http://www.erectionmeds.net/ discount cialis >:-DDD
8. Frankie (2012/03/01 15:43:47) 리플 수정 삭제
6 http://www.pillsdomain.com/ buy valtrex tablets =DD http://www.thibauthofer.com/ propecia wdccty http://www.painrelieveronline.com/ ultram yukt
9. Lorena (2012/03/02 19:23:35) 리플 수정 삭제
7 http://www.cheapautosinsur.com/ cheap auto insurance 67633 http://www.allcarinsur.com/ cheap car insurance 11208 http://www.pills-chart.com/ buy propecia 7036
10. Lakiesha (2012/03/10 15:52:59) 리플 수정 삭제
1 http://www.cheapautosinsur.com/ cheap auto insurance 96675 http://www.homecovercomparison.com/ home insurance quotes gcx http://www.yourqualitypills.com/ tamoxifen gqg
11. Jaylynn (2012/03/15 15:32:37) 리플 수정 삭제
4 http://www.insuranceinyourstate.com/ ghi health insurance 680514 http://www.insurers4u.com/ cheap california auto insurance 46515 http://www.gethealthinsur.com/ health insurance quotes 282 http://www.homeownersinsur.com/ mobile home insurance in florida 61609
 1  2  3

목록보기  답변달기  수정하기  삭제하기  글쓰기


131  자바 테스트 [1] asdf 2012/12/12 9398 04/23(20:41)
127  chart asdf 2012/11/05 10524
122  lazy image load [6] 윤동희 2012/04/17 10272 04/23(14:43)
121  mobile webpage [11] asdfq 2012/04/12 11983 04/16(19:37)
120  android desing asdfq 2012/04/12 10773
119  asdfasdf [2] asdf 2012/04/10 11681 04/10(14:43)
118  PredicateLayout??? adsf 2012/04/03 10609
117  adf [4] 3411 2012/04/02 10590 01/10(11:52)
116  ㄱㄱㄱㄱ [4] gerosyab 2012/03/27 10873 01/10(02:30)
115  위져 테스트 윤동희 2012/03/25 10860
114  pcap ㅁㄴㅇㄹ 2012/03/19 10289
113  red hot chili peppers [7] adf 2012/03/19 10915 01/13(22:00)
112  software development cost model [6] asdq 2012/03/15 10836 01/10(04:29)
111  ㄱㄷㅇㅁㅇㅇ [5] 윤동희 2012/02/24 10576 03/15(12:57)
110  pdf [1] asdf 2011/10/13 11198 02/10(01:30)
109  ppt [11] asdf 2011/10/13 11471 01/10(11:52)
108  gdiary 윤동희 2011/09/01 9783
107  ..asdf [2] 윤동희 2011/07/22 10157 07/29(03:49)
106  a* algorithm [7] 윤동희 2011/07/18 11327 01/09(19:23)
105  eng [5] 윤동희 2011/05/28 15005 01/08(20:28)
103  tracker 윤동희 2011/04/24 10624
102  weka [9] 윤동희 2011/04/06 11289 01/13(17:44)
101  ... [4] 윤동희 2011/03/27 11208 03/27(00:28)
100  Pacman Reference [13] 윤동희 2011/03/16 12772 01/12(00:08)
99  mfc opencv [9] 윤동희 2011/02/27 12033 03/02(15:40)
94  mine [1] 윤동희 2010/12/23 12165 02/25(23:48)
93  asdf [3] 윤동희 2010/12/17 12094 12/31(22:16)
92  server asdf 2010/12/12 11322
>>  mazr [24] 윤동희 2010/12/12 13182 11/15(10:47)
90  server [1] sadf 2010/12/11 11756 12/11(20:52)
89  asdfasdf [1] 윤동희 2010/12/11 11602 12/11(12:45)
88  asdf [2] 윤동희 2010/12/10 11985 12/30(07:56)
87  ㅁㄴㅇㄻㅇㄴㄹㄹ [9] ㅁㄴㅇㄹ 2010/12/09 13525 01/14(02:13)
86  asdf [1] 윤동희 2010/12/08 12649 12/09(13:48)
85  Boolean Logic - Java applet [1] 윤동희 2010/12/04 13900 12/29(09:46)
84  Socket Programming [60] 윤동희 2010/12/04 18719 12/31(20:04)
83  sfg [2] 윤동희 2010/12/04 16248 01/11(19:42)
82  android ~~ asdf 2010/12/02 16009
81  android bluetooth [3510] asdf 2010/12/02 77040 01/11(06:34)
80  embedded reference 윤동희 2010/12/02 15144
79  eseses [4083] ㅁㄴㅇㄹ 2010/11/23 108405 01/13(18:46)
78  ai #5 [37] 윤동희 2010/11/21 23374 11/06(14:24)
77  pacman [2] 윤동희 2010/11/07 9279 12/29(03:14)
74  sdsaxs [8] 윤동희 2010/11/01 9435 11/02(15:10)
73  후드집업 윤동희 2010/10/23 9391
71  adfadff [4] 윤동희 2010/10/20 9581 01/11(20:41)
70  zoom in (chap 1 ~ 5) [36] 윤동희 2010/10/20 11572 11/21(11:34)
-     RE:zoom in (chap 6 ~ 10) [10] 윤동희 2010/11/26 15881 01/14(05:04)
69  cinema eng ㅁㄴㅇㄹ 2010/10/19 9094
-     RE:cinema eng [1] 윤동희 2010/11/26 15510 12/12(03:07)
66  ai reference 윤동희 2010/10/18 9289
56  detect shake motion [7] 윤동희 2010/07/26 9680 07/26(17:00)
55  eclipse plugin eUML2 [3] asdf 2010/07/23 10072 01/10(13:50)
54  youtube 저작권 관련 강좌 [8] asdf 2010/07/23 10134 01/09(15:27)
52  호주호주호주호주호주 [1] ㅁㄴㅇㄻㅇ 2010/07/05 10079 07/12(22:50)
41  asdfasdfdfd [90] 윤동희 2010/05/30 27980 01/02(08:37)
39  ㅁㄴㅇㅎㄻㄴㅇㄻㄴㅇㄻㄹㅇ [1] 윤동희 2010/05/25 9877 05/25(12:44)
32  beat 윤동희 2010/05/06 10017
20  t design [5] fasdff 2010/04/11 9709 01/10(04:09)
16  adfadfadf [25] 윤동희 2010/04/05 11521 11/09(00:41)
7  flash [3] 윤동희 2010/03/21 9674 01/10(03:19)
2  큐베 게로 2010/03/12 9912
 1    

the MINIBOARD ,skin A4


Copyright Gerosyab all rights reserved.