Introduction

This is my blog of programming, I take notes and leave codes of computer science problems I solved here. Be my guest to comment :)

Sunday, October 28, 2012

uva 11044 - Searching for Nessy


Problem link

#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main() {
 int ntest;
 cin >> ntest;
 for (int test=1; test<=ntest; test++)
 {
  int n,m;
  cin >> n >> m;
  n-=2; m-=2;
  int col=m/3;
  if (m%3!=0) col++;
  int row=n/3;
  if (n%3!=0) row++;
  cout << (long long)col*row << endl;  
 }
 return 0;
}

No comments:

Post a Comment