#3824: RE煩死人....


klau1001 (Target Rank 20 ↑)

學校 : 香港中文大学
編號 : 12103
來源 : [42.200.130.74]
最後登入時間 :
2020-04-24 17:13:51
d626. 小畫家真好用 -- jack1 | From: [116.49.21.240] | 發表日期 : 2010-06-04 03:31

 這個不斷RE...

陣列 早就>所需...

為何還是re我汗...

 RE/傳送  = 10%......

 

#include<stdio.h>
    char board[1000][1000];
    int point[40000][10];
int main(){
    int head,tail;
    int N,i,j,x,y;

    while(scanf("%d",&N)==1){
                             head=0;tail=0;
                             for(i=1;i<=N;i++)
                                            scanf("%s",&board[i][1]);
                             scanf("%d %d",&x,&y);  
                             point[head][0]=x+1;point[head][1]=y+1;
                             tail++;
                             while(head<tail){
                                x=point[head][0];y=point[head][1];
                                board[x][y]='+';              
                               if(x>1){
                                       if(board[x-1][y]=='-'){
                                            point[tail][0]=x-1;point[tail][1]=y;
                                            tail++;                 
                                                              }
                                       }
                                if(y>1){
                                       if(board[x][y-1]=='-'){
                                            point[tail][0]=x;point[tail][1]=y-1;
                                            tail++;                 
                                                              }
                                       }
                                if(x<N){
                                       if(board[x+1][y]=='-'){
                                            point[tail][0]=x+1;point[tail][1]=y;
                                            tail++;                  
                                                              }
                                       }
                                if(y<N){
                                       if(board[x][y+1]=='-'){
                                            point[tail][0]=x;point[tail][1]=y+1;
                                            tail++;                  
                                                              }
                                       }
                                       head++;       
                                       }    
                               for(i=1;i<=N;i++){
                                            printf("%s\n",&board[i][1]);
                                            }       
                             }
    return 0;
}

 
#3825: Re:RE煩死人....


linishan (L)

學校 : 國立交通大學
編號 : 1090
來源 : [104.132.150.102]
最後登入時間 :
2019-05-10 19:57:54
d626. 小畫家真好用 -- jack1 | From: [125.226.152.42] | 發表日期 : 2010-06-04 19:18

 

scanf("%s",&board[i][1]);

這行怪怪的 ..

 
ZeroJudge Forum