#P4549. 【模板】裴蜀定理
【模板】裴蜀定理
Description
Given an integer sequence with elements, denoted as .
Find another integer sequence with elements. Let , such that and is as small as possible.
Input Format
The first line contains an integer , the number of elements in the sequence.
The second line contains integers, the sequence .
Output Format
Output a single integer on one line, the minimal value of subject to .
2
4059 -1782
99
Hint
Constraints: For of the testdata, , , and the sequence is not all zeros.
Translated by ChatGPT 5
京公网安备 11011102002149号