Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя _kite

Автор _kite, история, 5 лет назад, По-английски

Problem Link I have come up with a nice idea . I will just use three vectors to keep the negative numbers(v1),zeros(v2),positive numbers(v3).

Let the size of the vectors v1,v2,v3.

Then there will be (v1* v3) negative products , ((v1*v2 + (v3*v2)) zeros , ( (v1*(v1-1))/2 + (v3*(v3-1))/2) positive products.

So I can easily know whether Kth number will be negative or zero or positive.

But I am failing to print the answer when It is a positive number. I don't know how to find the positive product which is in this -- >( (v1*(v1-1))/2 + (v3*(v3-1))/2) count.

Please Help.

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

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
Spoiler