1 条题解
-
0
C :
#include<stdio.h> int LCM(int n,int m); int main() { int a,b; scanf("%d,%d",&a,&b); printf("%d\n",LCM(a,b)); return 0; } int LCM(int n,int m) { int x; int find=0; for(x=1;!find;x++) { if(x%n==0&&x%m==0) { find=1; } } return x-1; }
C++ :
#include<iostream> #include<cstdio> using namespace std; int gbs(int a,int b) { int r,s=a*b; if(a>b) { r=a%b; while(r!=0) { a=b; b=r; r=a%b; } return s/b; } else { r=b%a; while(r!=0) { b=a; a=r; r=b%a; } return s/a; } } int main() { int x,y; scanf("%d,%d",&x,&y); gbs(x,y); cout<<gbs(x,y); return 0; }
- 1
信息
- ID
- 465
- 时间
- 1000ms
- 内存
- 2MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者