/*********************
* 2012/07/04 *
* AOJ_Volume1_0104 *
* Magical_Tiles *
* crane *
**********************/
#include<iostream>
using namespace std;
#define MAX_N 101
char field[MAX_N][MAX_N];
bool f[MAX_N][MAX_N];
int main(){
int h,w; //縦,横
while(cin >> h >> w, (h||w)){
//field make
for(int i=0; i<h; i++)
for(int j=0; j<w; j++){
cin >> field[i][j];
f[i][j] = false;
}
int x = 0, y = 0;
while(1){
if(field[y][x] == '.' || f[y][x] == true) break;
f[y][x] = true;
switch(field[y][x]){
case '>':
x++;
break;
case '<':
x--;
break;
case '^':
y--;
break;
case 'v':
y++;
break;
}
}
if(f[y][x]) cout << "LOOP" << endl;
else cout << x << " " << y << endl;
}
return 0;
}
0 件のコメント:
コメントを投稿