Thursday, September 22, 2016

UVA 11044 - Searching for Nessy Solution

problem link-click here

in this problem, you have to divide both the rows and columns by 3 and have to multiply them as every sonar control 3x3 matrix according to the problem statement.

An accepted code is as follows:

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,m,t;

    cin>>t;

    while(t--)
    {
        cin>>n>>m;

        cout<<(n/3)*(m/3)<<endl;
    }

    return 0;
}

No comments:

Post a Comment