数学方法。
#include <iostream> #include <cmath> using namespace std; double n,m; int main() { cin >> n >> m; cout.precision(10); cout.setf(ios::fixed); cout << m*n-m-n-1+sqrt(2.0)*(n+m+1) << endl; return 0; } //by zzy