From 95aa076e8f302dcd69a5a19eb0fffbfe5b04dbd2 Mon Sep 17 00:00:00 2001 From: Jethro Stapelbroek Date: Mon, 3 Jul 2023 23:02:48 +0200 Subject: [PATCH] Rice judge (12/96) --- risdomare.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 risdomare.py diff --git a/risdomare.py b/risdomare.py new file mode 100644 index 0000000..6eff384 --- /dev/null +++ b/risdomare.py @@ -0,0 +1,27 @@ +n = int(input()) +prefer = input() + +bi = 0 +bt = 0 +ba = 0 +bs = 0 + + +for i in range(n): + a, s = map(int, input().split()) + if bt > a + s: + continue + elif bt == a + s and prefer == "antal" and a > ba: + bi = i + 1 + ba = a + bs = s + elif bt == a + s and s > bs: + bi = i + 1 + ba = a + bs = s + elif bt < a + s: + bi = i + 1 + bt = a + s + ba = a + bs = s +print(bi) \ No newline at end of file