for the result of the given equation to be an integer, the denominator must be an integer. So, the numbers in the denominator must be a square number ( n * n ) . Now, generate all possible square numbers between 10^9 and search for possible answers.
Hope it helps
Search found 16 matches
- Sun Apr 17, 2011 5:40 am
- Forum: Volume 119 (11900-11999)
- Topic: 11970 - Lucky Numbers
- Replies: 7
- Views: 5362
- Fri Apr 15, 2011 4:55 pm
- Forum: Volume 119 (11900-11999)
- Topic: 11958 - Coming Home
- Replies: 24
- Views: 8261
Re: 11958 - Coming Home
your code fails for the following test case:
1 20:00
19:00 60
the correct output is 1440 mins ( 23 hrs till the bus comes and another 60 mins for travelling )
hope it helps
1 20:00
19:00 60
the correct output is 1440 mins ( 23 hrs till the bus comes and another 60 mins for travelling )
hope it helps
- Sun Feb 06, 2011 7:36 am
- Forum: Volume 119 (11900-11999)
- Topic: 11908 - Skyscraper
- Replies: 6
- Views: 3027
11908 - Skyscraper
i tried to solve this problem using dp but how can i store the dp results in a table?? a N X N array exceeds the memory limit
- Wed Dec 22, 2010 9:04 pm
- Forum: Volume 4 (400-499)
- Topic: 414 - Machined Surfaces
- Replies: 49
- Views: 14945
Re: WA 414 pls help
And if i insert X in those blank spaces i will ended up with none or one blank space each line...
consider the test case
XXXXXXXXXXXBXXXXXXXXXXXXX
XXXXXXXXXXBBBXXXXXXXXXXXX
if you want to insert an X then you have to do so in all the lines. In the above there is 1 gap in the first line and 3 ...
consider the test case
XXXXXXXXXXXBXXXXXXXXXXXXX
XXXXXXXXXXBBBXXXXXXXXXXXX
if you want to insert an X then you have to do so in all the lines. In the above there is 1 gap in the first line and 3 ...
- Wed Dec 22, 2010 9:30 am
- Forum: Volume 114 (11400-11499)
- Topic: 11479 - Is this the easiest problem?
- Replies: 48
- Views: 27188
Re: 11479 - Is this the Easiest Problem?
what is the difference between the first and the last condition??else if ((a == b) || (a == c) || (a == b))
- Wed Dec 22, 2010 9:22 am
- Forum: Volume 110 (11000-11099)
- Topic: 11063 - B2-Sequence
- Replies: 73
- Views: 51553
Re: 11063 - B2-Sequence
I found a couple of mistakes...
First, the sequence must start with the number greater than 0.
Second,
this line is wrong.
Consider the test case:
3
1 3 4
The sequence is a B2 sequence but your output shows it is not a B2 sequence.
First, the sequence must start with the number greater than 0.
Second,
if(i>=2)if(Arr==(Arr[i-1]+Arr[i-2]))flg=1;
this line is wrong.
Consider the test case:
3
1 3 4
The sequence is a B2 sequence but your output shows it is not a B2 sequence.
- Wed Dec 22, 2010 9:00 am
- Forum: Volume 4 (400-499)
- Topic: 414 - Machined Surfaces
- Replies: 49
- Views: 14945
Re: WA 414 pls help
you should keep on bringing the two surfaces closer as long as there is atleast 1 gap in each line.....when this can no longer be done count the remaining gaps in all the lines. Hope this helps. 

- Wed Dec 22, 2010 8:51 am
- Forum: Volume 100 (10000-10099)
- Topic: 10032 - Tug of War
- Replies: 91
- Views: 43637
Re: 10032 - Tug of War
Think about dp( knapsack ) where the capacity of the knapsack is ( total weight of all people ) / 2 . Hope this helps 

- Tue Dec 21, 2010 9:24 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10041 - Vito's Family
- Replies: 90
- Views: 44569
Re: 10041 - Vito's Family
your logic is wrong.....
consider the test case:
1
4 1 2 4 5
the answer is 6( vito should build his house in 3 ) but your output is 4.
consider the test case:
1
4 1 2 4 5
the answer is 6( vito should build his house in 3 ) but your output is 4.
- Thu Dec 16, 2010 9:31 pm
- Forum: Volume 4 (400-499)
- Topic: 482 - Permutation Arrays
- Replies: 159
- Views: 53568
Re: 482 Permutation Arrays
the "sorted" array should be of 'int' type
- Thu Dec 09, 2010 8:46 pm
- Forum: Volume 4 (400-499)
- Topic: 488 - Triangle Wave
- Replies: 270
- Views: 64507
Re: WA 488
I think there should be a newline after the very last test case( not a blank line )
- Thu Dec 09, 2010 8:25 pm
- Forum: Volume 4 (400-499)
- Topic: 414 - Machined Surfaces
- Replies: 49
- Views: 14945
Re: WA 414 pls help
//gets(line);
I think uncommenting this part should avoid TLE.....however there is still a mistake....according to the given code 'maxx' stores the maximum gap in a single string among all the given strings and for the given test case :
3
XXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX ...
I think uncommenting this part should avoid TLE.....however there is still a mistake....according to the given code 'maxx' stores the maximum gap in a single string among all the given strings and for the given test case :
3
XXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX ...
- Thu Nov 11, 2010 7:56 am
- Forum: Volume 118 (11800-11899)
- Topic: 11838 - Come and Go
- Replies: 22
- Views: 11256
Re: 11838 - Come And Go
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cctype>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<sstream>
#include<vector>
using namespace std;
typedef vector<int> vi;
typedef vector< vi > vii;
typedef ...
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cctype>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<sstream>
#include<vector>
using namespace std;
typedef vector<int> vi;
typedef vector< vi > vii;
typedef ...
- Fri Nov 05, 2010 5:56 pm
- Forum: Volume 118 (11800-11899)
- Topic: 11883 - Repairing a Road
- Replies: 6
- Views: 3583
Re: 11883
what should have been the idea for solving this problem??oops, this is not the intended way to solve this problem. The test cases are not strong enough but I admit that I have no idea how to generate good ones. Any one has some ideas?
- Tue Nov 02, 2010 8:09 pm
- Forum: Volume 118 (11800-11899)
- Topic: 11883 - Repairing a Road
- Replies: 6
- Views: 3583
Re: 11883
thanks a lot bm_anas...i made a stupid error as well as reduced the eps to 1e-2 and AC!!!! thanks once again... 
