AC200了,总的来说这100题基本还都是水题,前面大部分是模拟,后来做了几道图论,算法用的不多,代码写的稍微熟练了一点,继续努力吧!周四要考科目二了,刷题暂停几天,祝自己能顺利通过,加油!
#include<stdio.h>
#include<string.h>
void mulitple_move(int *a, int *temp, int al, int n)
{
int i;
for (i = 0; i < n; i++)
temp[i] = 0;
for (i = 0; i < al; i++)
temp[i + n] = a[i];
}
int main()
{
int t;
scanf("%d", &t);
int a[1024], b[1024], c[1024], r[2048], temp[2048];
while (t--)
{
int n, m, k, i, j;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &a[n - 1 - i]);
scanf("%d", &m);
for (i = 0; i < m; i++)
scanf("%d", &b[m - 1 - i]);
scanf("%d", &k);
for (i = 0; i < k; i++)
scanf("%d", &c[k - 1 - i]);
memset(r, 0, 2048 * sizeof(int));
for (i = 0; i < m; i++)
{
if (b[i])
{
mulitple_move(a, temp, n, i);
for (j = 0; j < n + i; j++)
r[j] = r[j] ^ temp[j];
}
}
int total = n + m - 1;
while (total >= k)
{
mulitple_move(c, temp, k, total - k);
for (j = 0; j < total; j++)
r[j] = r[j] ^ temp[j];
while (!r[total - 1])
total--;
}
printf("%d", total);
for (i = 0; i < total; i++)
printf(" %d", r[total - 1 - i]);
putchar('\n');
}
return 0;
}