Блог пользователя neerj.ydv

Автор neerj.ydv, история, 6 лет назад, По-английски

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

  • Проголосовать: нравится
  • -11
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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 лет назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

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.