10分求助
查看原帖
10分求助
1157267
jngrkek11楼主2024/4/16 17:28
#include <bits/stdc++.h>
using namespace std;
long long n,m,c,d;
char a,s[201][201];
int main(){
	cin>>n>>m>>a;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>s[i][j];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(s[i][j]=='o'){
				if(a=='v'){
					for(int o=i;o<=n;o--){
						if(s[o][j]=='x'){
							cout<<"GG";
							return 0;
						}
					}
				}
				else if(a=='>'){
					for(int o=i;o<=m;o++){
						if(s[i][o]=='x'){
							cout<<"GG";
							return 0;
						}
					}
				}
				else if(a=='<'){
					for(int o=i;o<=m;o--){
						if(s[i][o]=='x'){
							cout<<"GG";
							return 0;
						}
					}
				}
				else if(a=='^'){
					for(int o=j;o<=n;o++){
						if(s[i][o]=='x'){
							cout<<"GG";
							return 0;
						}
					}
				}
			}
		}
	}
	cout<<"OK";
	return 0;
	}
2024/4/16 17:28
加载中...