日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Binary String Constructing(CF-1003B)

發布時間:2025/3/17 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Binary String Constructing(CF-1003B) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Problem Description

You are given three integers aa, bb and xx. Your task is to construct a binary string ss of length n=a+b such that there are exactly aa zeroes, exactly bb ones and exactly x?indices i (where 1≤i<n) such that si≠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<n and si≠si+1 (i=1,2,3,4). For the string "111001" there are two such indices ii (i=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 a, b and x (1≤a,b≤100,1≤x<a+b).

Output

Print only one string s, 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

Note

All possible answers for the first example:

1100;
0011.

All possible answers for the second example:

110100;
101100;
110010;
100110;
011001;
001101;
010011;
001011.

題意:給出 a,b,x,要求輸出一個含有 a 個 0,b 個 1 的字符串,要求這個字符串串剛好有 x 個 ai,滿足 ai != ai+1

思路:模擬,判斷奇偶關系,按要求輸出即可,需要注意的是 1 和 0 誰放在前的情況。

Source Program

#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<string> #include<cstdlib> #include<queue> #include<set> #include<map> #include<stack> #include<vector> #define INF 0x3f3f3f3f #define PI acos(-1.0) #define N 10001 #define MOD 123 #define E 1e-6 using namespace std; int main() {int a,b,x;while(scanf("%d%d%d",&a,&b,&x)!=EOF){if(x%2){int num=x/2;//記錄如果連續輸出01/10有多少位相鄰數字不一樣的if(a>b){while(num--)printf("01");a-=(x/2),b-=(x/2);//記錄剩余的1、0個數while(a--)printf("0");while(b--)printf("1");printf("\n");}else{while(num--)printf("10");a-=(x/2),b-=(x/2);//記錄剩余的1、0個數while(b--)printf("1");while(a--)printf("0");printf("\n");}}else{int num=x/2;if(a>b){for(int i=1;i<=num-1;i++)printf("01");a=a-(x/2)+1,b=b-(x/2)+1;//記錄剩余的1、0個數printf("0");a--;while(b--)printf("1");while(a--)printf("0");printf("\n");}else{for(int i=1;i<=num-1;i++)printf("10");a=a-(x/2)+1,b=b-(x/2)+1;//記錄剩余的1、0個數printf("1");b--;while(a--)printf("0");while(b--)printf("1");printf("\n");}}}return 0; }

?

總結

以上是生活随笔為你收集整理的Binary String Constructing(CF-1003B)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 小早川怜子久久精品中文字幕 | 一级片a级片 | 青青青草视频在线观看 | 谁有免费黄色网址 | 正在播放经典国语对白 | 好看的黄色录像 | 碰超在线 | 日韩电影网站 | 欧美成人精品一区二区免费看片 | 国产区一二 | 中文字幕理伦片免费看 | 熟睡侵犯の奶水授乳在线 | 无码人妻丰满熟妇啪啪网站 | 一区二区三区网 | 午夜免费播放观看在线视频 | 999久久久免费精品国产 | 国产a国产片国产 | 亚洲电影影音先锋 | 男人操女人网站 | 黑人极品ⅴideos精品欧美棵 | 欧美人与性动交g欧美精器 国产在线视频91 | 天天想你免费观看完整版高清电影 | 国产精品爽爽久久 | 在线观看福利片 | 无码人妻精品一区二区三区99不卡 | 大伊人网 | 日韩美女黄色片 | 日本一二三视频 | 超碰首页 | 国产精品久久91 | 美女高潮流白浆视频 | 亚洲高清色| 91最新地址永久入口 | 665566综合网| 精品一级少妇久久久久久久 | 日韩精品在线不卡 | 免费观看nba乐趣影院 | 在厨房拨开内裤进入毛片 | 91视频综合网 | 亚洲成年人影院 | 久久亚洲av成人无码国产电影 | 成人网免费视频 | 全部毛片永久免费看 | 99热久久这里只有精品 | 亚洲巨乳av| 91丝袜视频| 欧美嘿咻视频 | xxxxhdvideos| 一区二区三区日本视频 | av黄色免费网站 | 黄色特级网站 | 欧美69式性猛交 | 日韩av一区二区三区在线观看 | 亚洲一区二区日韩欧美 | 日韩三区视频 | 日韩av大片在线观看 | 夜晚福利视频 | 欧美日本一区二区 | 亚洲欧美国产另类 | 亚洲精品国产精品乱码视色 | 完全免费av| 欧美影院一区二区 | 午夜性刺激免费视频 | 人成在线视频 | 免费成人在线看 | 亚洲国产一区在线观看 | 秋霞成人av| 国产精品无码免费专区午夜 | 天堂网中文在线观看 | 黄网在线观看视频 | 无码少妇一区二区 | 综合色av | 手机看片欧美日韩 | 99午夜视频 | 国产ts在线 | 国产男同gay网站 | 久久精品国产网红主播 | 麻豆av导航 | 日韩在线观看精品 | 人成精品 | 国产精品久久久久久人妻精品动漫 | 91视频啪啪 | 欧美风情第一页 | 免费黄色一级大片 | 91网入口 | 91精品人妻一区二区三区果冻 | 狠狠躁夜夜躁人 | 黄色成人在线 | 1024日韩 | 日韩和一区二区 | 国产三级视频网站 | 欧美亚洲少妇 | 色视频免费看 | 亚洲www. | 国产成人tv| av影视天堂 | av黄在线观看 | 国产精品久久久久久久久久久久久久久 | 国产嫩草在线 |