Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In c++ please Probiem A. Arya Input file: standard input standard output 1 second 256 megabytes Output fle: Time limit Memory limit: Arya Stark wants

In c++ please
image text in transcribed
Probiem A. Arya Input file: standard input standard output 1 second 256 megabytes Output fle: Time limit Memory limit: Arya Stark wants to take dancing lessons. Given how much she loves dancing she wants to practice with her dancing master as much as possible. Her dancing master will be around for n days, and he will be available for training some h number of hours each day. As Arya usually has to skip some important banquet or tournament in order to practice, her father will only let her practice on k of the n days. How many hours can Arya practice in total, if she chooses her days optimally? Input The first line of input consists of two integers, n and k (1sks100), reresenting the number of days Arya's dancing master is available, and the number of days Arya is allowed to practice. Each of the next n lines contains a number h (1Shs10) describing the number of hours of the given practice Output Out put a single integer giving the maximum number of hours Arya can spend practcing. Example standard output 7 3 10 Note I: They're actually sword fighting lessons, but that's a secret kept between Arya and her father In the first test case, since Arya can practice on 3 days, she will choose the first, fourth, and sixth days for a total of 6+10+7-23 hours of practice

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Differentiate the function. r(z) = 2-8 - 21/2 r'(z) =

Answered: 1 week ago