利用最小公约数求最大公倍数 摘要:解题思路:利用最小公约数求最大公倍数参考代码:#include<stdio.h>int gcd(int m,int n) { if(m%n==0) return n; else return gcd(…… 题解列表 2024年12月08日 0 点赞 0 评论 513 浏览 评分:0.0
利用最小公约数求最大公倍数 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int gony(int m,int n){ int r; if(m==n) return m; else while((r=m%n…… 题解列表 2024年12月04日 0 点赞 0 评论 467 浏览 评分:0.0
最复杂的解题方法(但比较好理解) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int i,a,b,t; scanf("%d %d",&a,&b); if(a==b) …… 题解列表 2024年11月21日 0 点赞 0 评论 402 浏览 评分:0.0
辗转相除法求最小公倍数 #include#includeintmin_gbs(intn,intm){intt;while(n%m){t=n%m;n=m;m=t;}returnm;}intmain(){intn,m;inttemp;scanf("%d%d",&n,&m);if(n 题解列表 2024年03月24日 0 点赞 0 评论 538 浏览 评分:0.0
c语言代码解决问题 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int gcd(int a, int b){ int temp; while (a % b != 0) { temp = a % b;…… 题解列表 2023年10月13日 0 点赞 0 评论 540 浏览 评分:0.0
最小公倍数-----抽象JAVA 解题思路:注意事项:参考代码:importjava.math.BigInteger;importjava.util.*;publicclassMain{publicstaticvoidmain(String[]args){Scannersc=newScanner(System.in);BigInteg 题解列表 2023年04月06日 0 点赞 0 评论 504 浏览 评分:0.0
最小公倍数——辗转法 摘要:解题思路:辗转相除法注意事项:参考代码:a,b = map(int,input().split())c,d = a,bif a>b: a,b = b,ar = a%b while r !=0: …… 题解列表 2023年03月24日 0 点赞 0 评论 609 浏览 评分:0.0
1229基础解法(Python) 解题思路:直接调用Python的math库函数即可注意事项:Python3.9以上版本可以直接调用math.lcm()函数,其他版本只有math.gcd()函数参考代码:frommathimport*n,m=map(int,input().split())print(int(n*m/gcd(n, 题解列表 2023年03月06日 0 点赞 0 评论 537 浏览 评分:0.0
1229: 最小公倍数 摘要:解题思路:用递归的方法,就可以用简洁的代码解决了。注意事项:参考代码:n1,n2=map(int,input().split())def get(n1,n2): if n1%n2==0: …… 题解列表 2023年02月03日 0 点赞 0 评论 538 浏览 评分:0.0
编写题解 1229: 最小公倍数 摘要:解题思路:递归,求最大公约数(greatest common divisor,gcd),再求最小公倍数(least common multiple,lcm)。注意事项:参考代码:#include<io…… 题解列表 2022年09月06日 0 点赞 0 评论 644 浏览 评分:0.0