Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

shuiti

Posted by KatrineYang at 2016-09-13 13:58:41 on Problem 1319
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator