Pages

Saturday, June 2, 2012

11044 - Searching for Nessy


//
// main.cpp
// 11044 - Searching for Nessy
//
// Created by Panks on 29/05/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#include <iostream>
using namespace std;
int main (int argc, const char * argv[])
{

int t;
double a,b, froma, fromb;
int ifroma, ifromb;
cin>>t;
while (t--) {
cin>>a>>b;
a-=2;
b-=2;
froma=a/3.0;
fromb=b/3.0;

if (froma-(int)froma!=0) {
ifroma=(int)froma+1;
}else{
ifroma=(int)froma;
}


if (fromb-(int)fromb!=0) {
ifromb=(int)fromb+1;
}else{
ifromb=(int)fromb;
}

cout<<ifroma*ifromb<<endl;
}
return 0;
}

No comments:

Post a Comment