Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
最大公因数和最小公倍数
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 406, Accepted users: 287
Problem 10460 : No special judgement
Problem description
  给定两个整数ab,求其最大公因数GCD(a,b)及最小公倍数LCM(a,b)

Input
  输入数据有若干行,每行有两个整数ab(|a|,|b|<65536)

Output
  对每一行测试数据,在一行上先输出“Case #:”,其中“#”是测试数据的行编号(从1开始),接着在下面的两行上分别输出这两个整数的最大公约数和最小公倍数。如无最大公因数,则输出“no GCD”;如无最小公倍数,则输出“no LCM”;两组输出数据之间空一行,最后一组输出数据后面无空行。

Sample Input
6 11
0 0
6 9
Sample Output
Case 1:
GCD(6,11) = 1
LCM(6,11) = 66
 
Case 2:
no GCD
no LCM
 
Case 3:
GCD(6,9) = 3
LCM(6,9) = 18
Judge Tips
  当a!=0时,GCD(a,0)=a

Submit   Clarifications   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:2126 today,12073175 total, since 2010-05-07