当前位置:网站首页>Zzuli: maximum Convention and minimum common multiple
Zzuli: maximum Convention and minimum common multiple
2022-07-02 05:29:00 【Don't explode】
Title Description
Enter two positive integers , Output its maximum common divisor and minimum common multiple .
Input
Enter two positive integers n and m(n,m<=1000000). Input to ensure that the final result is int Within the scope of .
Output
Output two integers , Space off . Express m and n The greatest common divisor and the least common multiple of .
The sample input Copy
4 6
Sample output Copy
2 12
Tips
Pay attention to the overflow problem in the operation process
#include <stdio.h>
int main()
{
int m,n,r,i,a,b;
scanf("%d%d",&m,&n);
a=n;
b=m;
while(m%n!=0)
{
r=m%n;
m=n;
n=r;
}
i=b/n*a;
printf("%d %d",n,i);
return 0;
}
边栏推荐
猜你喜欢
No logic is executed after the El form is validated successfully
Gee series: unit 10 creating a graphical user interface using Google Earth engine [GUI development]
Win10 copy files, save files... All need administrator permission, solution
Dark horse notes -- Set Series Collection
Résumé de la collection de plug - ins couramment utilisée dans les outils de développement idea
指针使用详解
Gee series: Unit 5 remote sensing image preprocessing [GEE grid preprocessing]
Using Kube bench and Kube hunter to evaluate the risk of kubernetes cluster
Straighten elements (with transition animation)
LeetCode 241. Design priorities for operational expressions (divide and conquer / mnemonic recursion / dynamic programming)
随机推荐
Fabric. JS right click menu
With an amount of $50billion, amd completed the acquisition of Xilinx
Collectors. Groupingby sort
2022-2-14 learning xiangniuke project - section 23, section 5, development login and exit functions
XSS basic content learning (continuous update)
简单封装 js并应用
Innovation never stops -- the innovation process of nvisual network visualization platform for Excel import
Thread pool batch processing data
Draw a wave chart_ Digital IC
Nodejs (02) - built in module
Online music player app
Fabric.js IText设置指定文字的颜色和背景色
线程池批量处理数据
Fabric. JS three methods of changing pictures (including changing pictures in the group and caching)
记录sentry的踩坑之路
Youth training camp -- database operation project
Using QA band and bit mask in Google Earth engine
Two implementation methods of delay queue
Detailed explanation of Pointer use
Mysql基础---查询(1天学会mysql基础)