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

Автор lantimilan, 11 лет назад, По-английски

problem A:

// let (a1, a2) be the fractional pair we start and the integral target
// be (k1, k2)
// if a1 and a2 are both > 0, then k1 and k2 must be 0 and 1000
// if a1 and a2 are both = 0, then k1 = k2 = 0
// if a1 = 0 and a2 > 0, then we can make 0, 1000 or 0,0
//
// in other words, target is always 1000 unless we have a1 = 0
// we have n pairs, we can get as many as #zero of 0s
// we can get as little as (#zero — other) /2,
// notice that #zero and other must be same parity, because the sum
// of the two is 2n, an even number
//
// we can try all possible number of 0s for target, the rest is 1000
//

Полный текст и комментарии »

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