3999 - Sum Min 9

From Bitnami MediaWiki
Revision as of 18:45, 29 March 2023 by Andor Giulia (talk | contribs) (Pagină nouă: == Rezolvare == <syntaxhighlight lang="python" line="1"> n = int(input("Introduceti numarul de perechi: ")) suma_min = 0 for i in range(n): a, b = map(int, input("Introduceti perechea " + str(i+1) + ": ").split()) suma_min += min(a, b) print("Suma minima este:", suma_min) </syntaxhighlight>)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Rezolvare

<syntaxhighlight lang="python" line="1"> n = int(input("Introduceti numarul de perechi: ")) suma_min = 0

for i in range(n):

   a, b = map(int, input("Introduceti perechea " + str(i+1) + ": ").split())
   suma_min += min(a, b)

print("Suma minima este:", suma_min) </syntaxhighlight>