zoukankan      html  css  js  c++  java
  • CodeForces 711A Bus to Udayland (水题)

    题意:给定一个n*4的矩阵,然后O表示空座位,X表示已经有人了,问你是不能找到一对相邻的座位,都是空的,并且前两个是一对,后两个是一对。

    析:直接暴力找就行。

    代码如下:

    #pragma comment(linker, "/STACK:1024000000,1024000000")
    #include <cstdio>
    #include <string>
    #include <cstdlib>
    #include <cmath>
    #include <iostream>
    #include <cstring>
    #include <set>
    #include <queue>
    #include <algorithm>
    #include <vector>
    #include <map>
    #include <cctype>
    #include <cmath>
    #include <stack>
    #include <list>
    #include <sstream>
    #define frer freopen("in.txt", "r", stdin)
    #define frew freopen("out.txt", "w", stdout)
    using namespace std;
    
    typedef long long LL;
    typedef pair<int, int> P;
    const int INF = 0x3f3f3f3f;
    const double inf = 0x3f3f3f3f3f3f;
    const double PI = acos(-1.0);
    const double eps = 1e-8;
    const int maxn = 1e3 + 5;
    const int mod = 1e9 + 7;
    const int dr[] = {-1, 1, 0, 0, 1, 1, -1, -1};
    const int dc[] = {0, 0, 1, -1, 1, -1, 1, -1};
    const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
    int n, m;
    const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    inline int Min(int a, int b){ return a < b ? a : b; }
    inline int Max(int a, int b){ return a > b ? a : b; }
    inline LL Min(LL a, LL b){ return a < b ? a : b; }
    inline LL Max(LL a, LL b){ return a > b ? a : b; }
    inline bool is_in(int r, int c){
        return r >= 0 && r < n && c >= 0 && c < m;
    }
    char s[maxn][10];
    
    int main(){
        while(cin >> n){
            bool ok = false;
            for(int i = 0; i < n; ++i){
                scanf("%s", &s[i]);
                if(!ok && s[i][0] == 'O' && s[i][1] == 'O'){
                    s[i][0] = s[i][1] = '+';
                    ok = true;
                }
                else if(!ok && s[i][3] == 'O' && s[i][4] == 'O'){
                    s[i][3] = s[i][4] = '+';
                    ok = true;
                }
            }
            printf("%s
    ", ok ? "YES" : "NO");
            if(ok)
                for(int i = 0; i < n; ++i)
                    puts(s[i]);
        }
        return 0;
    }
    
  • 相关阅读:
    神奇的Batch Normalization 仅训练BN层会发生什么
    解决过拟合:如何在PyTorch中使用标签平滑正则化
    精度是远远不够的:如何最好地评估一个分类器?
    文本挖掘实战:看看国外人们在病毒隔离期间都在家里做什么?
    翻车现场:我用pytorch和GAN做了一个生成神奇宝贝的失败模型
    mysql安装步骤
    zabbix 02 监控项自定义
    zabbix 01 介绍安装
    Git 、Jenkins (三)Jenkins 安装部署
    Git 、Jenkins (二)Gitlub安装部署
  • 原文地址:https://www.cnblogs.com/dwtfukgv/p/5824209.html
Copyright © 2011-2022 走看看