Program The Future!!!
灵感引爆智慧,激情放飞理想!!!
Login:
[ Submit ] [ Statistic ] [ Status ] [ Discuss ]
1051.Easy Job
Time Limit: 1000 MS         Memory Limit: 65536 K
Total Submissions: 455 (93 users)         Accepted: 106 (64 users)

Description

  Today, Arxor gets a task. There are N cakes and N Boxes, and Arxor has to put these cakes into Boxes. It’s easy, isn’t it? Now Arxor wonders how many ways he can finish this task. By the way, Arxor is weak in big number, so you only have to output the decomposition quality factors of the answer. The format is as follow: p1^m1*p2^m2*p3^m3…. Here p1 < p2 < p3 < …. If mi = 1, the ‘^ mi’ should be neglected. E.g. you should output 2^2*3*5^2 if the answer is 300.

Input

  The input file contains several test cases.
  Each test case contains one line with a single integer N, 1 < N <= 1,000,000, the number of cakes.
  N = 0 indicates the end of input and should not be processed.

Output

  For each test case, output “Case #:” on the first line, '#' is the number of the test case. Then output the decomposition quality factors of the answer on the next line.

Sample Input

3
5
0

Sample Output

Case 1:
2*3
Case 2:
2^3*3*5

Source
厦门大学第四届程序设计竞赛 第一次网络预赛 by TheBeet @ btALT

[ Submit ] [ Statistic ] [ Status ] [ Discuss ]
All Copyright Reserved 2007 Xiang Guangte, Zheng Le
Xmu.Csd All Rights Reserved.