Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
shuiti#include <iostream> #include <stdio.h> #include <cmath> using namespace std; int main() { double a, b, c=2.0/sqrt(3.0); while(scanf("%lf%lf", &a, &b) == 2){ int grid = (int)(a+1e-10) * (int)(b+1e-10); int mx = grid; int m,n; n = (int)(c*(a-1)+1+1e-10); m = (int)(b-0.5+1e-10); int skew = m*n; if(skew > mx) mx = skew; m = (int)(b+1e-10); skew = (2*m-1)*(n/2)+m*(n%2); if(skew > mx) mx = skew; n = (int)(c*(b-1)+1+1e-10); m = (int)(a-0.5+1e-10); skew = m*n; if(skew > mx) mx = skew; m = (int)(a+1e-10); skew = (2*m-1)*(n/2)+m*(n%2); if(skew > mx) mx = skew; printf("%d ", mx); if(mx == grid) printf("grid\n"); else printf("skew\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator