第八篇英文翻译


出处:https://acs.jxnu.edu.cn/contest/22/board/challenge/C

Balance

Gigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other ordinary balance.
It orders two arms of negligible weight and each arm's length is 15. Some hooks are attached to these arms and Gigel wants to hang up some weights from his collection of G weights (1 <= G <= 20) knowing that these weights have distinct values in the range 1..25. Gigel may droop any weight of any hook but he is forced to use all the weights.
Finally, Gigel managed to balance the device using the experience he gained at the National Olympiad in Informatics. Now he would like to know in how many ways the device can be balanced.

Gigel有一种奇怪的“平衡”,他想保持平衡。实际上,该设备不同于任何其他普通天平。

它订购了两条重量可以忽略不计的手臂,每条手臂的长度为15。一些钩子连接到这些手臂上,Gigel想挂起他收集的G重量(1<=G<=20)中的一些重量,因为知道这些重量在1范围内有不同的值。。25.Gigel可以放下任何钩子的任何重量,但他必须使用所有重量。

最后,Gigel利用在全国信息学奥林匹克运动会上获得的经验,成功地平衡了设备。现在他想知道该设备可以通过多少种方式实现平衡。

Knowing the repartition of the hooks and the set of the weights write a program that calculates the number of possibilities to balance the device.
It is guaranteed that will exist at least one solution for each test case at the evaluation.

了解挂钩的重新分配和重量设置,编写一个程序,计算平衡装置的可能性数量。

保证在评估时,每个测试用例至少存在一个解决方案。

输入:

The input has the following structure:
? the first line contains the number C (2 <= C <= 20) and the number G (2 <= G <= 20);
? the next line contains C integer numbers (these numbers are also distinct and sorted in ascending order) in the range -15..15 representing the repartition of the hooks; each number represents the position relative to the center of the balance on the X axis (when no weights are attached the device is balanced and lined up to the X axis; the absolute value of the distances represents the distance between the hook and the balance center and the sign of the numbers determines the arm of the balance to which the hook is attached: '-' for the left arm and '+' for the right arm);
? on the next line there are G natural, distinct and sorted in ascending order numbers in the range 1..25 representing the weights' values.

输入具有以下结构:

?第一行包含数字C(2<=C<=20)和数字G(2<=G<=20);

?下一行包含-15范围内的C整数(这些数字也不同,并按升序排序)。。15代表吊钩的重新分配;每个数字代表相对于X轴上天平中心的位置(当未连接砝码时,装置平衡并与X轴对齐;距离的绝对值表示吊钩与平衡中心之间的距离,数字符号确定吊钩连接的天平臂:“-”表示左臂,“+”表示右臂);

?下一行有G个自然的、不同的、按升序排列的数字,范围为1。。25表示权重值。

输出:

The output contains the number M representing the number of possibilities to poise the balance.

输出包含数字M,代表平衡平衡的可能性数量。

样例输入:

2 4	
-2 3 
3 4 5 8

样例输出:

2

相关