ScratchData LogoScratchData
Back to scott170's profile

USACO Cow College Solve in Scratch except it isnt because I am lazy and dont want to do all the work

SCscott170•Created January 13, 2023
USACO Cow College Solve in Scratch except it isnt because I am lazy and dont want to do all the work
0
0
7 views
View on Scratch

Instructions

Python Code: n = int(input()) cows = list(map(int, input().split())) cows.sort() amount = [] for i, x in enumerate(cows): cost = x * (n-i) amount.append([x, cost]) minimum = min(amount, key=lambda item: item[0]-item[1]) print(minimum[1], minimum[0])

Description

http://www.usaco.org/index.php?page=viewproblem2&cpid=1251

Project Details

Project ID787522880
CreatedJanuary 13, 2023
Last ModifiedJanuary 13, 2023
SharedJanuary 13, 2023
Visibilityvisible
CommentsAllowed