2 条题解

  • 2
    @ 2025-7-19 11:34:35
    #include <bits/stdc++.h>
    #define LL long long
    using namespace std;
    const int N = 1e7 + 10;
    const int INF = 0x3f3f3f3f;
    int n , m;
    int f (int x , int y)
    {
    	if (x == y)
    	   return 1;
        if (x == 1)
    	   return y;
    	if (y == 1)
    	  return x;
    	if (x > y)
    	   return f (x - y , y) + 1;
    	else return f (y - x , x) + 1;
    	
    	
    	   
    	
    }
    int main()
    {
    	    cin >> n >> m;
    	    cout << f (n , m);
    		return 0;
    }
    

    信息

    ID
    1930
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    394
    已通过
    96
    上传者