2754Cutting the cake

2754   Cutting the cake

题目描述

As Fry’s birthday is coming, he get a cake which is bigger than bigger to serve his friends. But some of his friends could not sure about participating in the birthday party. There may be A people on the party, or maybe B people on the party, or may be C people on the party.

      Fry need to cut the cake into some pieces in advance and make sure whatever how many people there are on the party(A or B or C), all of people can get a share of cake, and all of people can get the same volume of cake. Attention any two people can not share a piece of cake.

      Now Fry wants to know the minimum number of piece he need to cut.

输入格式:

     There is a T at the beginning of input, show that there is T case follow.

      For each case, there are only three integer A, B, C, means the possible number of people there will be on the party.T<=1000,1<= A,B,C<=100

输出格式:

   For each case, output "Case #x: " , x mean the number of case,starting from 1.

  Then for each case, output only one integer, the minimum number the cake need to be cut.

输入样例 复制
2
1 2 4
2 3 4
输出样例 复制
Case #1: 4
Case #2: 6

说明

      For the second sample, Fry can cut the cake into 1/4 + 1/4 + 1/6 + 1/6 + 1/12 + 1/12. 

      If there are 2 people in the party, each of them can get half of cake (1/4 + 1/6+ 1/12).

      If there are 3 people in the party ,each of them can get 1/3 of cake, (1/4 + 1/12) , (1/4 + 1/12) , (1/6 + 1/6).

      If there are 4 people, each of them can get 1/4 of cake, (1/4) , (1/4) , (1/6 + 1/12) , (1/6 + 1/12).

10
22
通过提交
时空限制1000ms/128mb
题目来源
评测方式在线评测
题目类型http://www.jhcoj.cn/admin/problemList?page=32
难        度