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

Автор somnath796, история, 3 года назад, По-английски

Wael wrote on a single paper all different possible tuples (x,y,z) such that 1<=x,y,z<=N.Then ,he sorted them in the following order. First sort in increasing order according to their sum(x,y,z) . If two tuples have same sum ,then the tuple with smaller value of x is put first. Output the kth tuple from the sequence in format (x+2*y+3*z).

Input N= 2 K= 1

Output 6

Input N= 2 K= 3

Output 8

Input N= 50 K= 67

Output 19

Can anyone explain me the approach?

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