1 solutions

  • 0
    @ 2025-11-5 16:25:12

    C++ :

    #include<iostream>
    using namespace std;
    int main(){
    	int a,b,t;
    	cin>>a>>b;
    	if(a>b)t=b;
    	else t=a;
    	while(true)
    	{
    		if(a%t==0&&b%t==0){
    			cout<<"yue:"<<t;
    			break;
    		}
    		t--;
    	}
    	return 0;
    }
    
    

    Pascal :

    var a,b,c:longint;
    begin
      readln(a,b);
      if a>b then c:=b else c:=a;
      while (a mod c<>0) or (b mod c<>0) do c:=c-1;
      writeln('yue:',c);
    end.
    
    
    • 1

    Information

    ID
    17768
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By