标题:正在进行的ICPC的题目(NO.E)
取消只看楼主
蓝色神话
Rank: 2
等 级:论坛游民
威 望:1
帖 子:404
专家分:24
注 册:2006-5-11
 问题点数:0 回复次数:0 
正在进行的ICPC的题目(NO.E)

Find the largest LCM
Time Limit:4S Memory Limit:5120K


Description
I believe that most of you know how to split a positive integer N into the sum of several positive integers, such that their product is the biggest. We only shall try best to split N into the sum of multiple 3.
Then, how about splitting N such that their Least Common Multiplier (LCM) is the biggest?


Input
Input contains several test cases.
Each case has only one line, consisting of two positive integers, N and M. (0 < N <= 3000, 0 < M <= 10000)
The last case is followed by a line containing two zeros.


Output
The output for each case contains the biggest LCM's mod M.

Sample Input


6 23
6 23
0 0


Sample Output


Case 1: 6
Case 2: 6

谁能解决?

搜索更多相关主题的帖子: ICPC 
2006-10-07 14:12



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-94635-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.956817 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved