关于刚刚结束的T1
  • 板块学术版
  • 楼主REAL_曼巴
  • 当前回复11
  • 已保存回复11
  • 发布时间2021/1/10 17:30
  • 上次更新2023/11/5 04:57:16
查看原帖
关于刚刚结束的T1
371927
REAL_曼巴楼主2021/1/10 17:30

我70,求问题。

#include<iostream>
using namespace std;
char d[500][500];
int main(){
    int a,b,p,o;
    cin>>a>>b;
    char c;
    cin>>c;
    for(int i=1;i<=a;++i){
        for(int j=1;j<=b;++j){
            cin>>d[i][j];
            if(d[i][j]=='o')
                p=i,o=j;
    }
}
    if(c=='^'){
        for(int i=p;i>=1;--i){
        if(d[i][o]=='x'){
            cout<<"GG";
            return 0;
    }
    }
        cout<<"OK";
        return 0;
    }
    if(c=='v'){
        for(int i=p;i<=a;++i){
        if(d[i][o]=='x'){
            cout<<"GG";
            return 0;
    }
            }
        cout<<"OK";
            return 0;
    }
if(c=='>'){
        for(int i=o;i<=b;++i){
        if(d[p][i]=='x'){
cout<<"GG";
return 0;
}
}
cout<<"OK";
return 0;
}
if(c=='<'){
        for(int i=o;i>=1;--i){
        if(d[p][i]=='x'){
cout<<"GG";
return 0;
}
}
cout<<"OK";
return 0;
}
    return 0;
}
2021/1/10 17:30
加载中...