4 条题解

  • 1
    @ 2024-11-16 11:35:40
    #include<bits/stdc++.h>
    using namespace std; 
    int main(){
    	int a,b,c,d;
    	while(cin>>a>>b){
    		c=a%b;
    		d=a*b;
    		while(c!=0){
    			a=b;
    			b=c;
    			c=a%b;
    		}
    		cout<<b<<" "<<d/b<<endl;
    	}
    }
    
    • 0
      @ 2023-5-27 13:50:05

      #include <iostream> #include <cmath> #include <iomanip> #include <stack> #include <algorithm> #include <string> #include <cstring> #include <cstdio> using namespace std; const int INF = 0x3f3f3f3f; int main() { int a , b; while(cin >> a >> b) { int sum = a * b; while(b != 0) { int r = a % b; a = b; b = r; } cout << a << " " << sum / a << endl; } return 0; }

      • 0
        @ 2023-5-1 15:28:57
        #include<algorithm>
        using namespace std;
        int main(){
        	int m,n;
        	while(cin >>m>>n){
        		int sum = m*n;
        		while (n!=0){
        			int y=m%n;
        			m=n;
        			n=y; 
        		}
        		cout << m << " " << sum/m << endl;
        		
        	}
        	
        	return 0;
        }
        
        • 0
          @ 2022-7-6 21:01:03
          /*****************************************
          备注:
          ******************************************/
          #include <math.h>
          #include <stdio.h>
          #include <iostream>
          #include <string.h>
          using namespace std;
          int main()
          {
          	int a,b;
          	while(cin >> a >> b)
          	{
          		int sum = a* b;
          		while(b != 0)  // 辗转相除法
          		{
          			int r = a%b;
          			a = b;
          			b = r;
          		}
          		cout << a << " " << sum/a << endl;;
          	}
          
          
          }
          
          • 1

          信息

          ID
          977
          时间
          1000ms
          内存
          128MiB
          难度
          6
          标签
          递交数
          592
          已通过
          173
          上传者