zoukankan      html  css  js  c++  java
  • poj1753

    #include <stdio.h>
    char s[100][100];
    int s1[100][100];
    int ax[5]={0,-1,0,1,0};
    int ay[5]={0,0,-1,0,1};
    int b[100][100]={0};
     
    void main()
    {
        int H,W,N;
        scanf("%d %d %d",&H,&W,&N);
        while((H!=0)&&(W!=0)&&(N!=0))
        {
            for(int i=0;i<H;i++)
            {
                getchar();
                for(int j=0;j<W;j++)
                {
                    scanf("%c",&s[i][j]);
                    if(s[i][j]=='N')
                        s1[i][j]=1;
                    if(s[i][j]=='W')
                        s1[i][j]=2;
                    if(s[i][j]=='S')
                        s1[i][j]=3;
                    if(s[i][j]=='E')
                        s1[i][j]=4;
                }
     
            }
     
            for(int i=0;i<H;i++)
            {
                for(int j=0;j<W;j++)
                    printf("%d",s1[i][j]);
                printf(" ");
            }
            int x=0;
            int y=N-1;
            for(int i=0;i<=10;i++)
            {
                     
                b[x][y]=1;
                printf("%d %d  ",x,y);
                printf("%d  ",s1[x][y]);
                printf("%d %d ",ax[s1[x][y]],ay[s1[x][y]]);
                x+=ax[s1[x][y]];
                y+=ay[s1[x][y]];
                ///*if(x<0||y<0||x==H||y==W)
                //{
                //  printf("%d",i+1);
                //  break;
                //}*/
            }
             
            scanf("%d %d %d",&H,&W,&N);
        }
         
    }
  • 相关阅读:
    幸福
    华仔andylau
    计算机常用英语术语、词汇表
    新年新气象
    韶关二日游

    圣诞由来
    哈哈,今天起DK的blog也有隐私了^^
    POJ 2752 Seek the Name, Seek the Fame
    POJ 2406 Power Strings
  • 原文地址:https://www.cnblogs.com/452035305qq/p/6248645.html
Copyright © 2011-2022 走看看