codeforces 711A A. Bus to Udayland(水题)

题目链接:

A. Bus to Udayland

题意:

找一对空位坐下来,水;

思路:

 

AC代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <bits/stdc++.h>
#include <stack>
#include <map>
 
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<class T> 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<class T> 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;
}

  

posted @ 2016-08-30 09:38  LittlePointer  阅读(175)  评论(0编辑  收藏  举报