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\n", ok ? "YES" : "NO");
if(ok)
for(int i = 0; i < n; ++i)
puts(s[i]);
}
return 0;
}
CodeForces 711A Bus to Udayland (水题)的更多相关文章
- codeforces 711A A. Bus to Udayland(水题)
题目链接: A. Bus to Udayland 题意: 找一对空位坐下来,水; 思路: AC代码: #include <iostream> #include <cstdio> ...
- 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 ...
- 【模拟】Codeforces 711A Bus to Udayland
题目链接: http://codeforces.com/problemset/problem/711/A 题目大意: N个字符串,每个字符串5位,找到第一个出现两个OO的并改成++输出YES和改后字符 ...
- CodeForces 711A Bus to Udayland
简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...
- codeforces 577B B. Modulo Sum(水题)
题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树
A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...
- codeforces 696A Lorenzo Von Matterhorn 水题
这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...
- CodeForces 589I Lottery (暴力,水题)
题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...
- Codeforces Gym 100286G Giant Screen 水题
Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...
随机推荐
- 作业调度框架 Quartz.NET 2.0 StepByStep
注:目前网上诸多介绍Quartz.net的文章,甚至Quartz.net官网上的Tutorial都是1.0版本的,而这个项目在2.0版本对项目进行了比较大规模的修改,使得原有的很多例子都不能运行,故写 ...
- mongodb用户授权
1)登录admin 数据库,admin是隐藏的数据库,为mongodb的超级管理员数据表mongo admin新建用户db.createUser({'user':'test','pwd':'12345 ...
- css3 切换贞动画的效果,仿gif效果
/*---第一组动画---*/ .cartonGif_1{ position: absolute; display: block; background:url("img/haihangzh ...
- The Guide To Understanding mysqlreport
The Guide To Understanding mysqlreport This guide to understanding mysqlreport explains everything t ...
- php 使用date()函数的报错
错误提示: Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* ...
- db2数据库创建一张表,并为该表加上主键递增的性能和中间表的创建的sql语句
创建角色表 CREATE TABLE NBCTXP.TBL_NBC_NONBANKROLE ( ID BIGINT NOT NULL, ROLENAME VARCHAR(50), C ...
- python开发中常见的小坑
(1)可变参数类型作为函数参数默认值,函数参数默认值的设置在Python中只会被执行一次,也就是定义该函数的时候. 解决办法,设置为None,然后判断 (2)Python中的变量名解析遵循所谓的LEG ...
- hql查询语句 内存中的情况,fetch迫切查询关键字
Classes.java package cn.itcast.hiberate.sh.domain; import java.io.Serializable; import java.util.Set ...
- Free Candies
题意: 有4堆东西,每堆有n个每个有一个颜色,现在有一个篮子最多能装5个不同的颜色的东西,每次都从堆顶拿,当篮子出现两个相同颜色,可以获得这两个东西,求获得的最大数量 分析: 因为就4推,可以把各堆的 ...
- Oracle数据泵
要使用数据泵必须先创建数据库目录 数据库目录只允许sys创建 普通用户使用 必须授权 假设scott 用户是导出导入用户 SQL> ! mkdir dp_dir SQ ...