#include <bits/stdc++.h> #define ll long long using namespace std; int main(){ //freopen("huhu","r",stdin); //freopen("haha","w",stdout); ios_base::sync_with_stdio(0); cin.tie(0); ll a,b; cin>>a>>b; ll n=__gcd(a,b),m=0; for(ll i=2;i<=sqrt(n);i++) if(n%i==0){ m=max(i,m); m=max(n/i,m); } if(n==1)cout<<"-"<<n; else if(m==0)cout<<1; else cout<<m; return 0; }
dc
hint: mình tìm ước số chung rồi print ra số lớn thứ 2 thôi ^_^
Bình luận
dc
hint: mình tìm ước số chung rồi print ra số lớn thứ 2 thôi ^_^