// Problem: A. Di-visible Confusion
// Contest: Codeforces - Codeforces Round #752 (Div. 1)
// URL: https://codeforces.com/problemset/problem/1603/A
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 2022-02-18 14:58:38
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<=(r);i++)
#define per(i,l,r) for(int i=(l);i>=(r);i--)
#define ll long long
#define pii pair<int, int>
#define mset(s,t) memset(s,t,sizeof(t))
#define mcpy(s,t) memcpy(s,t,sizeof(t))
#define fir first
#define pb push_back
#define sec second
#define sortall(x) sort((x).begin(),(x).end())
inline int read () {
int x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch)) f |= (ch=='-'),ch= getchar();
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return f?-x:x;
}
template<typename T> void print(T x) {
if (x < 0) putchar('-'), x = -x;
if (x >= 10) print(x/10);
putchar(x % 10 + '0');
}
const int N = 1e5 + 10;
int a[N];
int n;
vector<int> te;
ll gcd (ll a, ll b) {
return b?gcd(b, a %b) : a;
}
ll lcm (ll a, ll b) {
return a * b / gcd (a, b);
}
void solve() {
int a, b, x;
cin >> a >> b >> x;
string ans = "";
while (x) {
int n = ans.size();
if (n == 0) {
if (a > b)
ans += "0", a --;
else
ans +="1", b --;
continue;
}
if (ans[n - 1] == '0')
{
ans += "1";
b --;
x --;
}
else {
ans += "0";
a --;
x --;
}
}
string temp = "";
for (int i = 0; i < ans.size(); i ++) {
if (ans[i] == '0') {
temp += ans[i];
while (a) {
temp += "0";
a --;
}
}
else {
temp += ans[i];
while (b) {
temp += "1";
b --;
}
}
}
cout << temp << endl;
}
int main () {
int t;
t = 1;
while (t --) solve();
return 0;
}
按照规则构造过去。首先将x归0; 然后将a, b归0.注意这一步要放在没有贡献的地方 10000001这中间的0只有首尾有贡献