题解:AT_arc211_b
gavinliu266 · · 题解
思路
我们让
然后我们把
举个例子,输入 5 12 12 时输出为:
000001111111
000000000000
000001111111000000000000
需要注意的是我们把第 5 12 12 时,输出的
000001000000
000000000000
注意到此时最长公共子串的长度是
于是你很开心地提交,获得了许多 WA。
注意到
代码实现
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a, b, c;
int t1[1005], t2[1005], t3[1005];
int main() {
scanf("%d%d%d", &a, &b, &c);
if(a == b) {
printf("%d ", a);
for(int i = 1; i <= a; ++i) printf("0 ");
printf("\n%d ", c);
for(int i = 1; i <= c; ++i) printf("0 ");
printf("\n%d ", c);
for(int i = 1; i <= c; ++i) printf("0 ");
return 0;
}
for(int i = a + 1; i <= c; ++i)
t1[i] = t3[i] = 1;
// t2[a + 1] = 0;
printf("%d ", b);
for(int i = 1; i <= b; ++i) printf("%d ", t1[i]);
printf("\n%d ", c);
for(int i = 1; i <= c; ++i) printf("%d ", 0);
printf("\n%d ", c * 2);
for(int i = 1; i <= c * 2; ++i) printf("%d ", t3[i]);
}