Runtime Error
/in/foo.cc: In function 'long long int work(long long int, long long int)': /in/foo.cc:4:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if(i==j)return i;long long k=j,l=i-j; ^~ /in/foo.cc:4:19: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' if(i==j)return i;long long k=j,l=i-j; ^~~~ /in/foo.cc: In function 'int main()': /in/foo.cc:10:28: warning: unused variable 's' [-Wunused-variable] long long n,m,restn,restm,s; ^
代码
#include<bits/stdc++.h>
long long work(long long i,long long j)
{
if(i==j)return i;long long k=j,l=i-j;
if(k<l)std::swap(k,l);
return j+work(k,l);
}
int main()
{
long long n,m,restn,restm,s;
std::cin>>n>>m;
restn=n/3;if(restn*3<n)restn++;
restm=m/3;if(restm*3<m)restm++;
std::cout<<std::max(m*work(n-restn,restn),n*work(m-restm,restm));
return 0;
}