【Codeforces Round #369 (Div. 2)】Codeforces 711A Bus to Udayland
来源:互联网 发布:python进入命令行模式 编辑:程序博客网 时间:2024/05/21 09:16
ZS the Coder and Chris the Baboon are travelling to Udayland! To get
there, they have to get on the special IOI bus. The IOI bus has n rows
of seats. There are 4 seats in each row, and the seats are separated
into pairs by a walkway. When ZS and Chris came, some places in the
bus was already occupied.ZS and Chris are good friends. They insist to get a pair of
neighbouring empty seats. Two seats are considered neighbouring if
they are in the same row and in the same pair. Given the configuration
of the bus, can you help ZS and Chris determine where they should sit?
InputThe first line of the input contains a single integer n (1 ≤ n ≤ 1000)
— the number of rows of seats in the bus.Then, n lines follow. Each line contains exactly 5 characters, the
first two of them denote the first pair of seats in the row, the third
character denotes the walkway (it always equals ‘|’) and the last two
of them denote the second pair of seats in the row.Each character, except the walkway, equals to ‘O’ or to ‘X’. ‘O’
denotes an empty seat, ‘X’ denotes an occupied seat. See the sample
cases for more details. OutputIf it is possible for Chris and ZS to sit at neighbouring empty seats,
print “YES” (without quotes) in the first line. In the next n lines
print the bus configuration, where the characters in the pair of seats
for Chris and ZS is changed with characters ‘+’. Thus the
configuration should differ from the input one by exactly two
charaters (they should be equal to ‘O’ in the input and to ‘+’ in the
output).If there is no pair of seats for Chris and ZS, print “NO” (without
quotes) in a single line.If there are multiple solutions, you may print any of them.
模拟。
#include<cstdio>#include<cstring>char s[1010][10];int main(){ int i,j,k,m,n,p,q,x,y,z; bool flag; scanf("%d",&n); for (i=1;i<=n;i++) scanf("%s",s[i]+1); flag=0; for (i=1;i<=n;i++) { if (s[i][1]=='O'&&s[i][2]=='O') { s[i][1]=s[i][2]='+'; flag=1; break; } if (s[i][4]=='O'&&s[i][5]=='O') { s[i][4]=s[i][5]='+'; flag=1; break; } } if (!flag) printf("NO\n"); else { printf("YES\n"); for (i=1;i<=n;i++) printf("%s\n",s[i]+1); }}
- Codeforces Round #369 (Div. 2) A. Bus to Udayland
- Codeforces Round #369 (Div. 2) A. Bus to Udayland
- Codeforces Round #369 (Div. 2) A. Bus to Udayland
- Codeforces Round #369 (Div. 2) A. Bus to Udayland【模拟】
- 【Codeforces Round #369 (Div. 2)】Codeforces 711A Bus to Udayland
- Codeforces #369(Div.2)A. Bus to Udayland【水题】
- CodeForces 711A A. Bus to Udayland
- codeforces 711A.Bus to Udayland 【水题】
- Codeforces 711A Bus to Udayland
- 【模拟】Codeforces 711A Bus to Udayland
- Codeforces 711A- Bus to Udayland
- Codeforces-711A-Bus to Udayland
- CodeForces 711A. Bus to Udayland【StringBuilder】
- CodeForces 711A Bus to Udayland
- codeforces 711 A. Bus to Udayland
- Codeforces 711A Bus to Udayland
- Codeforces Bus to Udayland
- CodeForces 711A Bus to Udayland(水题)
- iOS开发多线程GCD总结
- 理解Fragment生命周期
- PreparedStatement与Statement之间的区别
- 怎样下载苹果 Apple Store 官方 APP 里的限时免费应用福利?
- Prime Ring Problem (DFS)
- 【Codeforces Round #369 (Div. 2)】Codeforces 711A Bus to Udayland
- 微信支付官方SDK调通
- NSIS学习笔记三-中文测试
- SPA单页面应用
- SOCKET基础讲解
- 51Nod-1280-前缀后缀集合
- 711D
- 实现memove
- FreeWAF开源的WEB应用防火墙免邀请码下载