思路:
把每种情况都考虑到即可(具体看代码)
注意:
三个数都是有可能为0的,但是不会全为0
代码:
#include<bits/stdc++.h>
using LL = long long;
void solve(){
// I know you are here
// Thank you for your appreciation
int a, b, c;
std::cin >> a >> b >> c;
std::string ans;
if(a == 0) {
if(b == 0) { //此时c一定不为0
for(int i = 1; i <= c + 1; i++) {
ans += '1';
}
}
else { //否则讨论b的奇偶性
if(b & 1) { //当b是奇数时,先给答案填入一个0,最终第二类子串解决完后结尾一定是1
ans += '0';
int op = 1;
for(int i = 1; i <= b; i++) {
if(op & 1) ans += '1';
else ans += '0';
op++;
}
}
else { //当b为偶数时,先给答案填入一个1,最终第二类子串解决完后结尾一定是1
ans += '1';
int op = 1;
for(int i = 1; i <= b; i++) {
if(op & 1) ans += '0';
else ans += '1';
op++;
}
}
for(int i = 1; i <= c; i++) ans += '1'; //解决第三类子串即可
}
}
else {
for(int i = 1; i <= a + 1; i++) { //首先解决第一类子串
ans += '0';
}
if(b) { //若b为零则c一定也为零,因为题目保证答案一定存在
if(b & 1) { //当b为奇数时,将第二类子串解决完即可
int op = 1;
for(int i = 1; i <= b; i++) {
if(op & 1) ans += '1';
else ans += '0';
op++;
}
for(int i = 1; i <= c; i++) { //解决第三类子串
ans += '1';
}
}
else { //当b为偶数时,解决第二类子串,但是要剩下一个
int op = 1;
for(int i = 1; i < b; i++) {
if(op & 1) ans += '1';
else ans += '0';
op++;
}
for(int i = 1; i <= c; i++) { //解决第三类子串
ans += '1';
}
ans += '0'; //把第二类子串剩下那一个补上
}
}
}
std::cout << ans << "\n";
}
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);std::cout.tie(0);
int _;
std::cin >> _;
while(_--){
solve();
}
return 0;
}