题目链接-P2660 zzc 种田
解题思路
数论+贪心
#include<bits/stdc++.h>
#define int long long
#define lowbit(x) (x &(-x))
using namespace std;
const int INF=0x3f3f3f3f;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
const double PI=acos(-1.0);
const double eps=1e-10;
const int M=1e9+7;
const int N=1e5+5;
typedef long long ll;
typedef pair<int,int> PII;
signed main(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int x,y,ans=0;cin>>x>>y;if(x>y) swap(x,y);while(x&&y){ans+=x*(y/x);y%=x;swap(x,y);}cout<<ans*4<<endl;return 0;
}
本文发布于:2024-02-01 23:44:43,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170680717139939.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |