You are given three integers aa, bb and xx. Your task is to construct a binary string ssof length n=a+bn=a+b such that there are exactly aa zeroes, exactly bb ones and exactly xx indices ii (where 1≤i<n1≤i<n) such that si≠si+1si≠si+1. It is guaranteed that the answer always exists.

For example, for the string "01010" there are four indices ii such that 1≤i<n1≤i<n and si≠si+1si≠si+1 (i=1,2,3,4i=1,2,3,4). For the string "111001" there are two such indices ii (i=3,5i=3,5).

Recall that binary string is a non-empty sequence of characters where each character is either 0 or 1.

Input

The first line of the input contains three integers aa, bb and xx (1≤a,b≤100,1≤x<a+b)1≤a,b≤100,1≤x<a+b).

Output

Print only one string ss, where ss is any binary string satisfying conditions described above. It is guaranteed that the answer always exists.

Examples

Input

2 2 1

Output

1100

Input

3 3 3

Output

101100

Input

5 3 6

Output

01010100

题解:

根据0和1谁的数量大,确定从谁开始,然后n为奇数和偶数再分别判断即可

代码:

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring> using namespace std; int main()
{
int a,b,x,s;
int m,n;
cin>>a>>b>>x;
s=a+b;
if(a>b)
{
m=0;
n=1;
}
else
{
m=1;
n=0;
swap(a,b);
}
for(int i=0;i<x/2;i++) {cout<<m<<n;a--,b--;}
if(x%2==0){
while(b--) cout<<n;
while(a--) cout<<m;
}
else{
while(a--) cout<<m;
while(b--) cout<<n;
}
return 0;
}

CodeForces - 1003-B-Binary String Constructing (规律+模拟)的更多相关文章

  1. CF 1003B Binary String Constructing 【构造/找规律/分类讨论】

    You are given three integers a, b and x. Your task is to construct a binary string s of length n=a+b ...

  2. CodeForces 294B Shaass and Bookshelf 【规律 & 模拟】或【Dp】

    这道题目的意思就是排两排书,下面这排只能竖着放,上面这排可以平着放,使得宽度最小 根据题意可以得出一个结论,放上这排书的Width 肯定会遵照从小到大的顺序放上去的 Because the total ...

  3. Codeforces 960D Full Binary Tree Queries ( 思维 && 模拟 )

    题意 : 给出一颗无限层的满二叉树,然后每个值为 X (根的 X 等于 1 ) 左孩子的值是 2*X,右孩子的值是 2*X+1 ,现在有两种操作,(1, x,k) 表示将 x 所在层的所有节点整体向右 ...

  4. Educational Codeforces Round 94 (Rated for Div. 2) String Similarity、RPG Protagonist、Binary String Reconstruction、Zigzags 思维

    题目链接:String Similarity 题意: 首先题目定义了两个串的相似(串的构成是0.1),如果两个串存在对于一个下标k,它们的值一样,那么这两个串就相似 然后题目给你一个长度为2n-1的串 ...

  5. Codeforces 1107 E - Vasya and Binary String

    E - Vasya and Binary String 思路:区间dp + 记忆化搜索 转移方程看上一篇博客. 代码: #pragma GCC optimize(2) #pragma GCC opti ...

  6. Codeforces 862D. Mahmoud and Ehab and the binary string (二分)

    题目链接:Mahmoud and Ehab and the binary string 题意: 一道交互题,首先给出一个字符串的长度l.现在让你进行提问(最多15次),每次提问提出一个字符串,会返回这 ...

  7. Codeforces Round #598 (Div. 3) D. Binary String Minimizing 贪心

    D. Binary String Minimizing You are given a binary string of length n (i. e. a string consisting of ...

  8. D2. Kirk and a Binary String (hard version) D1 Kirk and a Binary String (easy version) Codeforces Round #581 (Div. 2) (实现,构造)

    D2. Kirk and a Binary String (hard version) time limit per test1 second memory limit per test256 meg ...

  9. Codeforces Round #598 (Div. 3) D. Binary String Minimizing

    You are given a binary string of length nn (i. e. a string consisting of nn characters '0' and '1'). ...

随机推荐

  1. matlab给图片插入说明文字

    text(cluster().center(),cluster().center(),num2str(),'color','k') 格式是text(x,y,'说明文字') x,y代表位置

  2. Struts2 自定义输入校验 第五弹

    Struts2的校验框架有两种:一种是validate方法,另一种是有效的xml文件. Action中自定义方法的输入校验,对于通过action的method属性所指定的自定义方法myExecute, ...

  3. base64编码方式

    一.编码的两大方式: 在python3.x中,字符串编码分为unicode和bytes两大类编码方式. 直接书写s='中国人',这种方式定义的编码方式为unicode,是通用的方式. 另一种是byte ...

  4. poj2228Naptime——环形DP

    题目:http://poj.org/problem?id=2228 dp[i][j][0/1]表示前i小时中第j小时睡(1)或不睡(0)的最优值: 注意第一个小时,若睡则对最终取结果有要求,即第n个小 ...

  5. 实际用户ID和有效用户ID (三) *****

    我们知道权限有r,w,x.其实除了这三个,还有特殊权限.比如: [root@localhost ~]# ls -l /usr/bin/passwd -rwsr-xr-x 1 root root 229 ...

  6. POJ3259(ford判环)

    Wormholes Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 39078   Accepted: 14369 Descr ...

  7. 用OpenLayers开发地图应用

    项目背景 最近有一个使用全球地图展示数据的项目,用地图展示数据本身没什么难度,但出于安全和保密的考虑,甲方单位要求项目不能连接外网,只能在内网使用,也就是说,我们不得不在内网中部署一个地图服务器,在这 ...

  8. OpenCode:template

    ylbtech-OpenCode: 1.返回顶部   2.返回顶部   3.返回顶部   4.返回顶部   5.返回顶部     6.返回顶部   作者:ylbtech出处:http://ylbtec ...

  9. strTemp.Format ("%.*lf",3,600.0);

    CString strTemp; strTemp.Format ("%.*lf",3,600.0); 这句话的含义?求指教   优质解答 这就是一个格式化输出,分号之前的CStri ...

  10. jvm虚拟机androidy移植-编译篇

    有这个必要吗?都过时的东西了,android上的Dalvik效率不够高吗,不够逼格吗? 是的但有总东西是不是我们这些码农能决定的,领导和项目需求才是你要关心的,毕竟工作要向领导汇报,项目要去挣钱钱,但 ...