编写题解 1027: [编程入门]自定义函数处理最大公约数与最小公倍数 摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int y(int a,int b) { for(int i=min(a,b);i>…… 题解列表 2024年08月09日 0 点赞 0 评论 318 浏览 评分:0.0
1027: [编程入门]自定义函数处理最大公约数与最小公倍数 摘要:```cpp #include using namespace std; int zdgys(int a,int b){ for(int i=a;i>=1;i--) if(a%i==0…… 题解列表 2024年07月02日 0 点赞 0 评论 216 浏览 评分:9.9
递归法(辗转相除法)求最大公约数 摘要:解题思路:用辗转相除法求最大公约数,在借助最大公约数求最小公倍数注意事项:参考代码:def yue(m,n): if n==0:return m else:return yue(n,m%n…… 题解列表 2024年06月01日 0 点赞 0 评论 243 浏览 评分:9.9
1027 最大公约数与最小公倍数(只求最大公约数即可求解) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int gongyueshu(int m,int n){ int max; if(m>n) { for(int i=n;i>=1;i-…… 题解列表 2024年05月14日 0 点赞 0 评论 131 浏览 评分:0.0
自定义函数处理最大公约数与最小公倍数 摘要:解题思路:题目要求要建函数,所以得知道怎么去建立函数,再考虑如何去求解,对于小白来说,解题的思路就是建立函数——建立主函数——调用函数注意事项:参考代码:#include<stdio.h>int gb…… 题解列表 2024年05月10日 0 点赞 0 评论 229 浏览 评分:0.0
无聊的星期六 摘要:解题思路:注意事项:参考代码:mun1,mun2=list(map(int,input().split())) max_num=max(mun1,mun2) min_num=min(mun1,…… 题解列表 2024年04月27日 0 点赞 0 评论 155 浏览 评分:0.0
自定义函数处理最大公约数与最小公倍数 摘要:解题思路:注意事项:参考代码:def function(a, b): c = min(a, b) max_GCD = 0 for i in range(1, c + 1)…… 题解列表 2024年04月18日 0 点赞 0 评论 358 浏览 评分:0.0
题解 1027: [C语言]自定义函数处理最大公约数与最小公倍数 摘要:解题思路:注意事项:参考代码:#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #inc…… 题解列表 2024年04月15日 0 点赞 0 评论 130 浏览 评分:0.0
比较好理解的解法 摘要:解题思路:先求出最大公约数,之后再用两数相乘后比上最大公约数,便可以得到最小公倍数注意事项:第二个返回值注意返回int参考代码:def f(a,b): a,b=max(a,b),min(a,b)…… 题解列表 2024年03月31日 0 点赞 0 评论 233 浏览 评分:9.9
简易求解最大公约数和最小公倍数 摘要:解题思路:这段代码的主要目的是求解两个整数的最大公约数和最小公倍数。1. 最大公约数(Greatest Common Divisor,GCD): - 首先,通过`da`函数计算最大公约数。 -…… 题解列表 2024年03月26日 0 点赞 0 评论 190 浏览 评分:9.9