题意

给你个排列    10001

满足下列条件输出yes  否则输出no

1、不能有两个1相连

2、当点排列不能再加入1

全0判断一下

开头判断一下

结尾判断一下

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
char str[];
int main()
{
int n,i,pre,cnt = ;
bool flag = false;
scanf("%d",&n);
scanf("%s",str);
if(n == )
{
if(str[] == '')
printf("Yes\n");
else
printf("No\n");
return ;
}
pre = -;
if(str[] == '')
{
pre = ;
flag = true;
}
for(i=;i<strlen(str);++i)
{
if(str[i] == '')
{
flag = true;
if((i-pre!=) && (i-pre!=))
{
printf("No\n");
return ;
}
pre = i;
}
}
i--;
if(str[i] == '')
{
if(i - pre == || i-pre == )
flag = false;
}
if(flag)
printf("Yes\n");
else
printf("No\n");
}

codeforces982A的更多相关文章

随机推荐

  1. 5I - 汉诺塔IV

    还记得汉诺塔III吗?他的规则是这样的:不允许直接从最左(右)边移到最右(左)边(每次移动一定是移到中间杆或从中间移出),也不允许大盘放到小盘的上面.xhd在想如果我们允许最大的盘子放到最上面会怎么样 ...

  2. iOS.Info.plist

    1. Custom message when asking for Address Book Permissions http://kevinyavno.com/blog/?p=176

  3. window 安装gdal和python

    进入 http://www.gisinternals.com/release.php 中下载下图(也可以不是这个版本但是下载的python和gdal一定要版本对应) 1.点击下图中release-17 ...

  4. Codeforces 787D. Legacy 线段树建模+最短路

    D. Legacy time limit per test:2 seconds memory limit per test:256 megabytes input:standard input out ...

  5. python 日志滚动 分文件

    import logging from logging.handlers import RotatingFileHandler import datetime import os def main() ...

  6. Microsoft translater

    professional  tranlater tool : https://translator.microsoft.com/neural/

  7. gunicorn配置文件

    最近使用gunicorn部署,感觉用命令参数方式启动比较繁琐,而且有时候就忘了以前怎么设置的了.一笑... 上stackoverflow查了查,找到了一个官方示例,在这里. 官方解释在这里. 记在这里 ...

  8. libmysqlclient version

    You probably know that the version number of the libmysqlclient.so library has changed from .16 to . ...

  9. kbmmw 5.04 发布

    增加了一大波功能,消灭了一大堆问题,也肯定引进了一大票BUG.We are happy to announce the release of our latest version of kbmMW. ...

  10. GUI的优化操作/添加背景图片等

    一.背景图片的添加这是JAVA中添加背景图片的方式,基本思路先建立一个Label标签,然后建立一个层次的布局,将label标签添加到最下面去. ImageIcon image=new ImageIco ...