#P4134. [BJOI2012] 连连看
[BJOI2012] 连连看
Description
Among IQ-test problems there is often an elimination game. But this round of Lianliankan is not the visual-matching game on QQ. Our rule is: given all integers in the closed interval , if there exist two numbers , () such that their square difference is a perfect square , and and are coprime, then you may connect and , remove them together, and gain points. The goal is to maximize the number of removable pairs, and subject to that, maximize the total score. Try to figure it out.
Input Format
One line with two integers, denoting and .
Output Format
Two integers: the number of pairs that can be removed, and, under that condition, the maximum total score.
1 15
2 34
Hint
Constraints:
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号