1 条题解

  • 0
    @ 2025-4-7 21:41:57

    C :

    #include <stdio.h>
    
    void output( int m, int n ) {
      int t = m;
      while( t % n != 0 ) {
        t += m;
      }
      printf("%d\n", t);
    }
    
    int main(){
      int m, n;
      while( ~scanf("%d%d", &m, &n) ) 
            output(m, n);
    }
    

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int n,m;
    int main()
    {
        while(cin>>n>>m&&n&&m)
        {
        	cout<<n*m/__gcd(n,m)<<"\n";
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    2118
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者