当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3139:Balancing the Scale

题目描述

You are given a strange scale (see the figure below), and you are wondering how to balance this scale. After several attempts, you have discovered the way to balance it — you need to put different numbers on different squares while satisfying the following two equations:

x1 * 4+x2 * 3+x3 * 2+x4=x5+x6 * 2+x7 * 3+x8 * 4
y1 * 4+y2 * 3+y3 * 2+y4=y5+y6 * 2+y7 * 3+y8 * 4

How many ways can you balance this strange scale with the given numbers?

输入解释

There are multiple test cases in the input file. Each test case consists of 16 distinct numbers in the range [1, 1024] on one separate line. You are allowed to use each number only once.

A line with one single integer 0 indicates the end of input and should not be processed by your program.

输出解释

For each test case, if it is possible to balance the scale in question, output one number, the number of different ways to balance this scale, in the format as indicated in the sample output. Rotations and reversals of the same arrangement should be counted only once.

输入样例
87 33 98 83 67 97 44 72 91 78 46 49 64 59 85 88
0
输出样例
Case 1: 15227223

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Shanghai 2006

源链接: POJ-3139

最后修改于 2020-10-29T06:54:02+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536