zoj 1037 最短路

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=37

找规律,水题

 1 #include<iostream>
 2 #include<cmath>
 3 #include<iomanip>
 4 using namespace std;
 5 
 6 int main()
 7 {
 8           int n;
 9           cin>>n;
10           for(int i = 1;i<=n;i++)
11           {
12                     cout<<"Scenario #"<<i<<":
";
13                     int m,n;
14                     cin>>m>>n;
15                     double d;
16                     if(m%2==0 || n%2 == 0)
17                               d = m*n;
18                     else
19                               d = m*n-1+sqrt(2);
20                     cout<<fixed<<setprecision(2)<<d<<endl<<endl;
21           }
22 }
原文地址:https://www.cnblogs.com/qlky/p/4963406.html