can anybody please help in solving the problem
what is wrong with solution:
https://www.codechef.com/viewsolution/12835638
can anybody please help in solving the problem
Dear! You are over-complicating a simple question!
Here, note this observation.
Lets say that a number n has factor f and multiple m.
Now, we can say n=kf since f is factor of n. [k is a integer]
And m is l*n , where l is another integer.
==>m= k x l x f.
==>m is divisible by f. Agree?
So all you need to do is a divisibility test!!
Check my solution [here][1]
EDIT1- I think what you are trying to do, is supposing if multiple is negative, like 3 x (-2) = -6. Have a look at constraints. It states that f and m >0. And since multiple, by definition, is an integral multiple of n, it is guaranteed that m>f. I hope this helps you dear!!
[1]: https://www.codechef.com/viewsolution/12835778
thanks…but i din’t get one thing…what is wrong with my code?
Give me ~10 minutes, I will debug it for you.
Your code is giving time limit exceeded in cases like
factor = 2 , multiple = 10^18
Because of multiple test cases, what your program does is to subtract it till f and m become equal or something. This is making it do ALOT of unnecessary operation which lead to it exceeding time limit. Use % operator and the Q will be easily solved!!
Hope it answered your query!!
yup
thanks!!
I did not face like this problems. Really i have no idea about this problems. Hope so many people watching this post. Some one having good knowledge about this will help you to get the exact solution for your problem. Be cool and wait for wonderful answers.
jericoacoara motel
jericoacoara property
jericoacoara rentals