#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
typedef pair<ll,ll> pii;
int main()
{
ll H,M,A;
scanf("%lld%lld%lld",&H,&M,&A);
if(A==H*M/2)
{
printf("%lld",H*M);
return 0;
}
ll d=__gcd(H-1,H*M);
printf("%lld",d*(A/d*2+1));
}
Rise of Shadows(2020 ICPC shenyang I)
最新推荐文章于 2022-09-21 22:05:18 发布