Page 2 of 2
Posted: Thu Jun 29, 2006 3:29 pm
by sohel
a part of your code.
Both
* and
/ have the same precedence and is left associative. That is, first multiplication is done, followed by division.
r*s suffers from overflow as its value can exceed MAX_INT_LIMIT..
2 solutions..
1] convert to r / gcd(r,s) * s or
2] use long long
Posted: Thu Jun 29, 2006 6:26 pm
by sohag144
Thank you.I got accepted.
10892 - LCM Cardinality
Posted: Wed Jul 05, 2006 12:02 pm
by Mushfiqur Rahman
I need some input and also some output for LCM Cardinality .
Problem no 10892.
A lot of thanks for Sender .
SOME TESTCASES PLEASE...
Posted: Thu Jul 13, 2006 6:01 pm
by nymo
Hi, I need some test cases, please...

Posted: Tue Jul 18, 2006 12:24 pm
by Tanu
Think about the prime input...
Posted: Wed Jul 19, 2006 6:42 am
by nymo
For prime input, my code gives output 2.
and..... what should be the output if the input is 1?
Posted: Wed Jul 19, 2006 8:25 am
by Tanu
I have no scope here to compile my code in this time...
I think for input 1 output must be 1...
This is my algo ...
Compare Yourself...
1. 1st find all the divisor of the given input.Save in array and sort.
{
the way may recursive
or->
a loop i:from 2 to sqrt(N)
if(N%i == 0)
then add both i and N/i to the divisor list.
}
2. then use an N^2 loop to find whose lcm is the given. count them.
I/0 for 10892
Posted: Sat Jul 22, 2006 4:38 pm
by murkho
INPUT::
2
12
10000000
11111111
12345678
98746521
4587754
1
7485874
8888888
9999999
4512454
0
OUTPUT::
2 2
12 8
10000000 113
11111111 41
12345678 68
98746521 41
4587754 5
1 1
7485874 14
8888888 32
9999999 23
4512454 5
Posted: Tue Sep 12, 2006 10:55 pm
by serendipity
hey my code shows WA for perfect square number:( can someone tell me how to handle this problem?
wot is the prime algorithm for this cardinality problem?
--regards

Re: 10892 - LCM Cardinality
Posted: Thu Nov 13, 2014 6:16 pm
by richatibrewal
How can we solve the problem by prime factors method??
Re:
Posted: Wed Feb 17, 2016 6:42 pm
by nasif2587
J&Jewel wrote:This problem can also be solved by the prime....solution...
hi J&Jewel, can you explain the prime factorization merhod for this problem?