neerj.ydv's blog

By neerj.ydv, history, 6 years ago, In English

I was solving questions for practice and eventually came across this problem A of CFR 347 div2 . In this question the GCD of two numbers 100 and 100000 is 100. But when i submit my solution it shows 100 is wrong answer and right answer is 1. Probably i am unable to understand the question. Can anyone explain me the problem clearly?

Here is the link to the problem. https://mirror.codeforces.com/contest/664/problem/A

  • Vote: I like it
  • -11
  • Vote: I do not like it

| Write comment?
»
6 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

It is not asking for gcd(a, b). It is asking for gcd(a, a+1, a+2, ..., b). In your case it is gcd(100, 101, 102, ..., 100000) = 1, as gcd(100, 101) is already 1.

»
6 years ago, hide # |
 
Vote: I like it -9 Vote: I do not like it

Question isn't wrong . you have to find gcd of a,a+1,a+2,........,b. so in your case, you have to find gcd(100,101,102,........,100000). so answer will be 1.