zoukankan      html  css  js  c++  java
  • 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('
    ');
    }
     
    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
    ";
            For(i,1,n)
            {
                for(int j=0;j<=4;j++)printf("%c",s[i][j]);
                    printf("
    ");
            }
        }
        else cout<<"NO
    ";
        return 0;
    }
    

      

  • 相关阅读:
    HDU1026 Ignatius and the Princess I
    luogu_1865 A % B Problem
    luogu_1092 虫食算
    luogu_1111 修复公路
    luogu_1265 公路修建
    luogu_2330 [SCOI2005]繁忙的都市
    luogu_1613 跑路
    luogu_3386 【模板】二分图匹配
    luogu_3388 【模板】割点(割顶)
    luogu_2327 扫雷
  • 原文地址:https://www.cnblogs.com/zhangchengc919/p/5820628.html
Copyright © 2011-2022 走看看