0

I found this question in some programming contest..

Given are N squares with side 1. How many "different" rectangles can one form using these squares?

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

sample input : 6

sample output : 8

visit this link to see the 8 rectangles...

https://vn.spoj.pl/content/ae00.jpg

This is my program which works correctly until 192 squares but after 192 it ends abruptly .. Pls help me with this error ..

By the way I use DevCpp for coding C++ progs

```
.
#include<iostream>
using namespace std;
int main()
{
long int sq,tmp=1;
cin>>sq; //Input number of squares
int rect=1;
for(int j=2;j<=sq;j++)
{
tmp=1;
for(int i=2;i<=j;i++)
if(j%i==0) //finding the relevant divisors which can be rectangles
{
if(j==2 || j/tmp>1)
{
rect++;
}
tmp=tmp*i;
}
}
cout<<rect<<endl; //print number of rectangles possible
system("pause");
}
```