Meaning of the questions:
Given two polynomials, the two polynomials multiplied by the polynomial, coefficients of presence is not divisible by p, then the output power where the coefficient term.
Ideas:
In fact, read the meaning of the title, well done. Because want coefficient not divisible by p, then
it can not be divisible by p two items, then we just can not find a inside divisible by p, and then find there is not divisible by p, b, can output power and two of the
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, p;
while (cin >> n >> m >> p)
{
int ia = -1, ib = -1;
for (int i = 0, a; i < n; i++)
{
cin >> a;
if (a % p && ia < 0)
{
ia = i;
}
}
for (int i = 0, b; i < m; i++)
{
cin >> b;
if (b % p && ib < 0)
{
ib = i;
}
}
cout << ia + ib << endl;
}
return 0;
}
···