ZOJ 1037 - Gridland

 1  /*  Accepted 1037 C++ 00:00.48 848K  */
 2  #include  < math.h >
 3  #include  < iostream >
 4 
 5  using   namespace  std;
 6 
 7  int  main()
 8  {
 9      cout.setf(ios_base::showpoint);
10      cout.setf(ios_base:: fixed );
11      cout.precision( 2 );
12      
13       int  n, m, k;
14      
15      cin  >>  k;
16       for ( int  i  =   1 ; i  <=  k; i ++ )
17      {
18          cin  >>  n  >>  m;
19          cout  <<   " Scenario # "   <<  i  <<   ' : '   <<  endl;
20           if (n  %   2   &&  m  %   2 )
21              cout  <<  (n  *  m  -   1   +  pow( 2 0.5 ))  <<  endl;
22           else
23              cout  <<   double (n  *  m)  <<  endl;
24          cout  <<  endl;
25      }
26      
27       return   0 ;
28  }
29 

你可能感兴趣的:(ZOJ 1037 - Gridland)