codeforce 401C 构造
来源:互联网 发布:哪个软件有哥特式字体 编辑:程序博客网 时间:2024/06/08 08:09
#include <iostream>#include <cstdio>using namespace std;int n, m;int main(int argc, char const *argv[]){while (~scanf("%d%d", &n, &m)){if (m < n - 1 || m > 2 * n + 2) printf("-1");else if (n >= m){for (int i = 0; i < m; i++) printf("01");for (int i = 0; i < n - m; i++) printf("0");}else if (2 * n >= m){for (int i = 0; i < m - n; i++) printf("110");for (int i = 0; i < 2 * n - m; i++) printf("10");}else{for (int i = 0; i < n; i++) printf("110");for (int i = 0; i < m - 2 * n; ++i) printf("1");}printf("\n");}return 0;}
n个0,m个1,构造一个序列,不能出现“00”或者“111”。
举例分析,注意无解的情况。
0 0
- codeforce 401C 构造
- codeforce 803C Maximal GCD(构造)
- codeforce 509C (很有趣的贪心模拟构造)
- codeforce 743 C. Vladik and fractions (数学构造)
- codeforce 862C Mahmoud and Ehab and the xor(构造)
- Codeforce # C. Average Score
- CodeForce 279C
- codeforce 237 C D
- Codeforce C. Barcode
- Codeforce 57C Array
- Codeforce 240C Practice
- Codeforce 332C
- codeforce 370C
- codeforce 400 C
- codeforce 6C
- codeforce 12C map
- codeforce 14C
- codeforce 18C
- Could not load the Tomcat server configuration at \Servers\Tomcat v7.0 Server at localhost-config
- 数组合并3个一维数组合并成一个新的二维数组
- android中线程的应用
- launch failed.Binary not found
- 前5个默尼森数
- codeforce 401C 构造
- linux采用NAT的连接方式连接网络时,宿主机能ping通虚拟机,虚拟机ping不通宿主机
- Extjs+Struts+Spring+Hibernate——excel导入
- 第九章多态抽象
- Eclipse打包unity3d工程
- C任意进制转换程序
- spring与redis集成之aop整合方案
- 大数据处理
- C#命名参数