Adding Least Common MultiplesProblem code: LCM |
All submissions for this problem are available.
Given A and B, compute the sum of lcm(a, b) over all pairs of positive integers a and b such that:
(1) a<=A and b<=B.
(2) There is no integer n>1 such that n2 divides both a and b.
Give your answer modulo 230.
Input
The first line contains the number of test cases, t (about 200). Each of the next t lines contains two space-separated integers A and B (1<=A, B<=4000000).
Output
Print the answer to each test case on a separate line.
Example
Input: 4 2 4 3 3 6 5 8 3 Output: 24 28 233 178
| Author: | MichaelD |
| Date Added: | 6-05-2010 |
| Time Limit: | 2 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

output for 6 5 should be 237
output for 6 5 should be 237
@Ankit Sablok Output is
@Ankit Sablok
Output is correct.
You forget to delete the pair (4,4).
I had a working solution to
I had a working solution to this problem since so much time but its just giving me this freaking error
Runtime Error (Other)
I m using python and It satisfies everything !!!!!!!!!!!
Common man , i m r00t, so work !!!!
And Yes its so stupid to
And Yes
its so stupid to write this way : 1<=A, B<=4000000
Dont u think its a pun ???
It conveys two things
1: A and B lie in integers b/w 1 and 4 * pow(10,6) (inclusive)
2: A>=1 without upperbound, B is possitive with a upper bound of 4 x 10^6
What's the meaning of 'Source
What's the meaning of 'Source limit'?
What's the meaning of
What's the meaning of this...? "Give your answer modulo 230"
@Bhathiya Jayasekara: It
@Bhathiya Jayasekara:
It means that you should divide the result by 230 and output the remainder.
@Antoyn I have successfully
@Antoyn I have successfully deleted that pair and still get 237
@ Aleksandar Stankovski
@ Aleksandar Stankovski
thanks, and please tell me what does it mean by source limit is 50000?
@Ankit Sablok even i am
@Ankit Sablok
even i am getting 237 for that test case
@Akshay - 1 <= A, B <=
@Akshay - 1 <= A, B <= 4000000 means 1 <= A <= 4000000 and 1 <= B <= 4000000, and is used very commonly.
@Bhathiya - source limit is the maximum size of your source code.
@Ankit, Anurag - The sample output is correct. That is all you need to know.
@Stephen-made a stupid
@Stephen-made a stupid mistake.i finally got 233.thnx anyways
@Stephen- can you tell me one
@Stephen-
can you tell me one thing..When i get a TLE can i be sure that my code gave the right answer?
FAQ
FAQ
@Stephen- thnx
@Stephen-
thnx
my code gives the right
my code gives the right answer for the sample input, but wrong answer here...But atleast im not getting a timeout....gotta find that problematic case.....
When i submitted my program
When i submitted my program it gives internal error. What that means ??
mine too.. internal error???
mine too.. internal error???
and i checked in forums admin
and i checked in forums admin said check out ur recent submissions for correct status of your submissions but there is nothing in "my submissions " neither in recent sctivity in main page..
please take a look at it admins.
thanks
its ok now its giving TLE
its ok now its giving TLE
my coide is ok in my machine
my coide is ok in my machine but its giving a time out error
is 2 seconds the total time
is 2 seconds the total time for 200 cases?
Yes. FAQ
Yes. FAQ
in above problem is A always
in above problem is A always less than B or not?
getting TLE...
getting TLE...
There is no integer n>1 such
There is no integer n>1 such that n2 divides both a and b.
cud not understand above point..can anyone explain plz.
i uploaded exactly same
i uploaded exactly same code(which was running on my machine) twice ........once it gave compilation error.............the other time it gave TLE..........how is it possible......your compilers has some bugs ? ........i didn't even open the file b/w the two successive uploads...
can i know how much time
can i know how much time theprogram takes......
bcoz i hv submitted the code but its showing time exceeded
what is the meaning of there
what is the meaning of there is no integer n>1 such that n2 divides both a and b.
Which part of that sentence
Which part of that sentence don't you understand?
@ADMIN yes, this is
@ADMIN
yes, this is confusing? what is n?
is it one of a or b ? is it the lcms which we are adding? i think someone should answer that question ?
my bad got it now ..sorry,
my bad got it now ..sorry, should have read carefully.. the second comment makes it clear
i am getting :( internal
i am getting :( internal server error..
and also, i am using php
and doing get_file_contents("in,txt")
is it ok to do so on codechef?
else how would i take input using php?
and finally, i am storing result in out.txt
if i am wrong somewhere please tell me immediately coz i got working code.
no matter what, i keep
no matter what, i keep getting internal server error. why?
and @ Team Cyclone, why do you post code?
its disgusting to see other's code.
is the time limit(2 seconds)
is the time limit(2 seconds) for a single test case or for all the test cases together?
we are not able to get your
we are not able to get your view exactly.........
what are A and B in the problem........
What is n here?? n2 does not
What is n here?? n2 does not divide a and b is ok.. but what is the range of n and what exactly it is??
n is any integer greater than
n is any integer greater than 1, as the problem statement says.
After submission I have got
After submission I have got an error
/sources/tested.cpp:1: error: expected unqualified-id before numeric constant
what is it mean?
I did not get any error when I compiled in eclipse(helios) using mingw32-g++
A lot of confusion with
A lot of confusion with n..
1st test case of example..
Suppose, i choose (2,3) pair, and let n=6
then n2 divides both 2 and 3.. ?? what is the range of n(i know it is greater than 1) but less than what??
Please correct me..
36 is not a divisor of 2 or
36 is not a divisor of 2 or 3.
got it!thanks..
got it!thanks..
i downloaded some solutions,
i downloaded some solutions, but they are giving different outputs with same input. Moreover, two or more solutions don't even give the same result....can anyone explain??/
and even when i give the test
and even when i give the test cases given here, the output is much greater then given here, about 6-8 digits per output.
@nitin surana The code
@nitin surana
The code submitted by Aswin Akhilesh is actually correct. Probably your compiler is not treating SUM[0]=0. So if its not treating that way, just make SUM[0] explicitly equal to 0 under calculateSUM() of Aswin Akhilesh's code.