-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathSHOP.cpp
More file actions
71 lines (48 loc) · 1.57 KB
/
SHOP.cpp
File metadata and controls
71 lines (48 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include<iostream>
#include<stdio.h>
#include<queue>
using namespace std;
struct node
{
int x,y;
};
long dist[25][25]={100000000};
int main()
{
while(true)
{
int h,w;
cin>>w>>h;
if(h==0 && w==0)
break;
char gh[h+2][w+2];
for(int i=0;i<w+2;i++)
{
gh[0][i]='X';
gh[h+1][i]='X';
}
for(int i=0;i<h+2;i++)
{
gh[i][0]='X';
gh[i][w+1]='X';
}
queue<node> qu;
for(int i=1;i<=h;i++)
{
for(int j=1;j<=w;j++)
{
cin>>gh[i][j];
if(gh[i][j]=='S')
{
dist[i][j]=0;
node temp;
temp.x=i;
temp.y=j;
qu.push(temp);
}
}
}
}
system ("pause");
return 0;
}