题意:给定一个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\n", ok ? "YES" : "NO");
if(ok)
for(int i = 0; i < n; ++i)
puts(s[i]);
}
return 0;
}

CodeForces 711A Bus to Udayland (水题)的更多相关文章

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

    题目链接: A. Bus to Udayland 题意: 找一对空位坐下来,水; 思路: AC代码: #include <iostream> #include <cstdio> ...

  2. Codeforces Round #369 (Div. 2) A. Bus to Udayland 水题

    A. Bus to Udayland 题目连接: http://www.codeforces.com/contest/711/problem/A Description ZS the Coder an ...

  3. 【模拟】Codeforces 711A Bus to Udayland

    题目链接: http://codeforces.com/problemset/problem/711/A 题目大意: N个字符串,每个字符串5位,找到第一个出现两个OO的并改成++输出YES和改后字符 ...

  4. CodeForces 711A Bus to Udayland

    简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...

  5. codeforces 577B B. Modulo Sum(水题)

    题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树

    A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...

  7. codeforces 696A Lorenzo Von Matterhorn 水题

    这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...

  8. CodeForces 589I Lottery (暴力,水题)

    题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...

  9. Codeforces Gym 100286G Giant Screen 水题

    Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...

随机推荐

  1. VS2010 需要缺少的web组件才能加载该项目

    到的问题是解决方案中部分项目无法加载, 提示需要缺少的web组件才能加载该项目,是否通过WEB安装组件来网络安装, 点击确定以后就什么也没有了. 到微软网站去下载Microsoft Web Platf ...

  2. (转)FirstResponder 释放问题

    FirstResponder 释放问题 转自:http://www.cnblogs.com/smileEvday/archive/2012/03/18/2405190.html View的FirstR ...

  3. 浅析extendedLayout, automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars

    参考文章: http://stackoverflow.com/questions/18798792/explaining-difference-between-automaticallyadjusts ...

  4. C的结构体使用

    C的结构体演示 #include <stdio.h> struct A //建立结构体A { char *name; int s1; struct A *next; }; void mai ...

  5. HDU 5038 Grade

    解题思路:这题最关键的是要读懂题意,If not all the value are the same but the frequencies of them are the same, there ...

  6. 【英语】Bingo口语笔记(62) - 生气道歉场景的表达

  7. 【自动化测试】Selenium处理富文本框

    http://blog.csdn.net/fudax/article/details/8089404 selenium处理富文本框,日历控件等 调用JS修改value值 document.getEle ...

  8. nodejs开发阶段利器supervisor

    在开始学习nodejs时,往往一般写代码,一边看效果.先停止node,再重新运行.非常耗时. 这时supervisor派上了用场. 安装 推荐使用npm,本人一直使用局部安装,这样可以将全部文件安装在 ...

  9. MySQL内存表-临时表

    HEAP表是访问数据速度最快的MySQL表,他使用保存在内存中的散列索引.但如果MySQL或者服务器重新启动,表中数据将会丢失.用法:如论坛的在线人数统计,这种表的数据应该是无关紧要的,就几个简单的字 ...

  10. Shell教程6-Shell注释

    以“#”开头的行就是注释,会被解释器忽略. sh里没有多行注释,只能每一行加一个#号.只能像这样: #-------------------------------------------- # 这是 ...