Using KISS :)
http://en.wikipedia.org/wiki/KISS_principle
Ps: is not an offensive message
Wladimir Araujo Tavares
*Federal University of CearĂ¡ http://lia.ufc.br/%7Ewladimir/
Homepage http://lia.ufc.br/%7Ewladimir/ |
Maratonahttps://sites.google.com/site/quixadamaratona/|
*
On Fri, Sep 28,
@Wladimir : you have to use formula given in below link
http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle
On Fri, Sep 28, 2012 at 12:26 AM, Wladimir Tavares wladimir...@gmail.comwrote:
what happens when a = 3, d = 5
a, a + d, d +2, a +3 d = 3,8,13,18?
Wladimir Araujo
why not just brute force this? one little array contains [a, (a+d),
(a+2d), (a+3d), (a+4d) ], which is then filtered so that none of those are
multiples of another.
Then set a count variable to m-n+1. Check all numbers in range against
your little array, decrementing count and breaking out if a
thanks for your reply.. actually i was thinking the same thing.. but I am
facing problems in finding the unique multiples of a+3d and a+4d as
applying inclusion exclusion principle in this way is getting too difficult
due to large no of factors to be added and subtracted.. is der any other
@ashish : here is the generalized equation
http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle
note : you need to take LCM of a,a+d,a+2d etc etcwhenever you are
dividing to find count
On Thu, Sep 27, 2012 at 2:55 AM, ashish pant asheesh...@gmail.com wrote:
thanks for
what happens when a = 3, d = 5
a, a + d, d +2, a +3 d = 3,8,13,18?
Wladimir Araujo Tavares
*Federal University of CearĂ¡ http://lia.ufc.br/%7Ewladimir/
Homepage http://lia.ufc.br/%7Ewladimir/ |
Maratonahttps://sites.google.com/site/quixadamaratona/|
*
On Thu, Sep 27, 2012 at 8:57 AM, atul
an idea of the approach would be enough.. plz help..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
help needed in spoj problem EASYMATH http://spoj.pl/problems/EASYMATH.. i
thought about inclusion exclusion principle but unable to get to a
solution.. plz help..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the
please suggest something :
Problem :
http://www.spoj.pl/problems/EASYMATH/
C++ code :
http://ideone.com/r2OSb
was getting wrong ans due to over flow i think in LCM() for big prime's i guess.
thin tried in python .
Now getting NZEC for python code which mean's high level or recurrsion
some
use return (a/gcd(a,b)*b instead
On Sun, Jun 24, 2012 at 7:10 PM, Sourabh Singh singhsourab...@gmail.comwrote:
please suggest something :
Problem :
http://www.spoj.pl/problems/EASYMATH/
C++ code :
http://ideone.com/r2OSb
was getting wrong ans due to over flow i think in LCM() for big
dont post codes, ask whether your algorithm is correct or not.
On Sun, Jun 24, 2012 at 8:29 PM, Hassan Monfared hmonfa...@gmail.comwrote:
use return (a/gcd(a,b)*b instead
On Sun, Jun 24, 2012 at 7:10 PM, Sourabh Singh
singhsourab...@gmail.comwrote:
please suggest something :
Problem
11 matches
Mail list logo