Wrong Answer
/in/foo.cc: In function 'int main()': /in/foo.cc:4:28: warning: unused variable 's' [-Wunused-variable] long long n,m,restn,restm,s,ansn=0,ansm=0; ^
代码
#include<bits/stdc++.h>
int main()
{
long long n,m,restn,restm,s,ansn=0,ansm=0;
std::cin>>n>>m;
restn=n/3;if(restn*3<n)restn++;
restm=m/3;if(restm*3<m)restm++;
long long k,i=n-restn,j=restn;
while(i!=j)
{
if(i<j)std::swap(i,j);
ansn+=j;
k=j;
j=i-j;
i=k;
}
ansn+=j;
i=m-restm,j=restm;
while(i!=j)
{
if(i<j)std::swap(i,j);
ansm+=j;
k=j;
j=i-j;
i=k;
}
ansm+=j;
std::cout<<std::max(m*ansn,n*ansm);
return 0;
}