本文共 1269 字,大约阅读时间需要 4 分钟。
题目链接:
题意:
找一对空位坐下来,水;
思路:
AC代码:
#include #include #include #include #include #include #include #include using namespace std; #define For(i,j,n) for(int i=j;i<=n;i++)#define mst(ss,b) memset(ss,b,sizeof(ss)); typedef long long LL; template void read(T&num) { char CH; bool F=false; for(CH=getchar();CH<'0'||CH>'9';F= CH=='-',CH=getchar()); for(num=0;CH>='0'&&CH<='9';num=num*10+CH-'0',CH=getchar()); F && (num=-num);}int stk[70], tp;template inline void print(T p) { if(!p) { puts("0"); return; } while(p) stk[++ tp] = p%10, p/=10; while(tp) putchar(stk[tp--] + '0'); putchar('\n');} const LL mod=1e9+7;const double PI=acos(-1.0);const int inf=1e9;const int N=1e5+20;const int maxn=4e3+220;const double eps=1e-12;char s[2000][10];int main(){ int n,flag=0; read(n); For(i,1,n)scanf("%s",s[i]); For(i,1,n) { if(s[i][0]=='O'&&s[i][1]=='O') { flag=1; s[i][0]='+'; s[i][1]='+'; break; } if(s[i][3]=='O'&&s[i][4]=='O') { flag=1; s[i][3]='+'; s[i][4]='+'; break; } } if(flag) { cout<<"YES\n"; For(i,1,n) { for(int j=0;j<=4;j++)printf("%c",s[i][j]); printf("\n"); } } else cout<<"NO\n"; return 0;}
转载于:https://www.cnblogs.com/zhangchengc919/p/5820628.html