Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

B题

Posted by granite at 2006-11-22 15:58:42
Balancing the scale
Input File: balance.in

Problem Description

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 �C you need to put different numbers on different squares while satisfying the following two equations:



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

Input Specification                                                                                   

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.

Output Specification

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.

Sample Input

4 1 8 20 6 5 3 10 40 10 80 200 100 30 50 60

0

Sample Output

Case 1: 2438410


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator