Простое деление
Can you say me why in example third test's answer is 3, because when 14 div 3 remeinder is 2 and when -22 div 3 remeinder is -1. I can't understand why?
The statement says that q * d <= n. Consider n = -22, d = 3... Then the one such q, that suits q * d <= n and q * d is max available, is q = -8:
q * d = -8 * 3 = -24;
Then the value of r = n - q * d = -22 - (-24) = 2.
В условии написано: "Для каждого теста вывести наибольшее целое число, которое если поделить на каждое число последовательности, то получится один и тот же остаток."
По идее должно было быть: "Для каждого теста вывести наибольшее целое число, НА которое если поделить каждое число последовательности, то получится один и тот же остаток."
"There will be at least 2 and no more than 1000 numbers in a sequence;" - actually, at least 3 nonzero numbers
"not all numbers occurring in a sequence are equal" - actually, all numbers are different