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 | #include<iostream>
#include<string>
using namespace std;
int main()
{
string str;
char arr[30][30];
int n, s, x, y;
while (cin >> n >> s)
{
cin >> str;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
cin >> arr[i][j];
x = 0;
y = s;
cout << s;
for (int i = 0; i < str.length(); i++)
{
for (int j = 1; j <= n; j++)
{
if (arr[y][j] == str[i])
{
cout << j;
y = j;
break;
}
}
}
cout << endl;
}
return 0;
}
|
沒有留言:
張貼留言