Header Ad

HackerEarth Teaching how to draw problem solution

In this HackerEarth Teaching how to draw problem solutions HackerMan has brought a new drawing book for his child, which consists only of geometric shapes. Its consists of lessons where the child has to make drawings using geometric shapes. The first lesson is based on how to use squares to build different objects.

You are task is to help HackerMan in teaching one part of this lesson. You have to help him in determining, given S number of squares, how many distinct rectangles you can build out of that.

Two rectangles are considered different if none of them can be rotated and moved to obtain the second one. During rectangle construction, the child can neither deform the squares nor put any squares upon any other ones.


HackerEarth Teaching how to draw problem solution


HackerEarth Teaching how to draw problem solution.

#include <bits/stdc++.h>

using namespace std;

int main()
{
int t , n;

cin >> t;

while(t--){

cin >> n;

int i = 1, ans = 0;

while(n / i >= i){

ans += n / i - (i - 1);
i++;
}

cout << ans << "\n";
}


return 0;
}

Post a Comment

0 Comments