#P3868. [TJOI2009] 猜数字
[TJOI2009] 猜数字
Description
There are two groups of numbers, each with elements.
The numbers in the first group are denoted by , and the numbers in the second group are denoted by .
The numbers in the second group are pairwise coprime. Find the smallest such that for , holds.
Input Format
The first line contains an integer .
The second line contains integers: .
The third line contains integers: .
Output Format
Output a single integer, which is the required answer .
3
1 2 3
2 3 5
23
Hint
Constraints:
,,,.
Time limit per test case: 1 second.
Note: For C/C++ language, 64-bit integers should be declared as long long.
If using scanf and printf (as well as fscanf, fprintf, etc.), use the %lld specifier.
Translated by ChatGPT 5
京公网安备 11011102002149号