Time Exceeded
/in/foo.cc: In function 'int main()': /in/foo.cc:9:22: warning: unused variable 's' [-Wunused-variable] int n,m,restn,restm,s; ^
代码
#include<bits/stdc++.h>
int work(int i,int j)
{
if(i==j)return i;
return j+work(j,i-j);
}
int main()
{
int 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;
}