PRCS16A - Editorial

ad-hoc
cakewalk
editorial
prcs16a
proc2016

#1

PROBLEM LINK:

Practice
Contest

Author: Rounaq Jhunjhunu Wala
Tester: Parth Mittal
Editorialist: Rounaq Jhunjhunu Wala

DIFFICULTY:

CAKEWALK

PREREQUISITES:

None

PROBLEM:

Given 3 numbers P_1,P_2,P_3 and a number W, we need to check if sum of a pair of P_i > W.

EXPLANATION:

We just need to try all the pairs and check whether any of the pair-sum exceeds W.

will_defeat = false
if P1+P2 > best: will_defeat = true
if P1+P3 > best: will_defeat = true
if P2+P3 > best: will_defeat = true
return will_defeat