Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU C++ language problems to be solved I'm sure you've all heard of Hashmat, the valiant

PLEASE DO NOT COPY PASTE FROM CHEGG/OTHERWISE I'LL REPORT YOU

image text in transcribed

C++ language problems to be solved I'm sure you've all heard of Hashmat, the valiant warrior. He was battling a bunch of soldiers the last time you saw him. He is, however, on his own this time. Who needs an army when you can absorb your opponent's whole strength by simply vanishing him? Hashmat is going to be the sole conqueror of a city. To enter the city, he must defeat N opposing soldiers. He starts with a P. The soldiers will arrive in the order that has been assigned to them. He can only kill a soldier if he is stronger than or equal to him. When he kills a soldier, he absorbs all of the soldier's power and grows stronger. When he comes up against a soldier who is stronger than him, he utilises an unique weapon to quickly kill that soldier; Hashmat's strength does not rise in this situation. So far, he seems to have little trouble conquering the city. So far, no. K times is the maximum number of times he can utilise the special weapon. Can you tell me if he'll be able to conquer the city based on the information you have? Input The first line of the input contains three integers: N (15 N s 105) represents the number of soldiers Hashmat encounters, POSP 105 represents Hashmat's initial strength, and K (0 = K = N) represents the number of times he can use the special weapon. The following line contains an array A of N numbers that indicate the soldiers' strength in order. Where O SA 106 is equal to 1 (1313N). Output Print a single line that says "YES" if Hashmat can conquer the city and "NO" if he can't. Print the strings without the quotation marks and a newline. 1-5-4-2-3-5-7-19-19-19-19-19-19-19-19-19 Output 2 3 YES YES YES YES YES Y

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

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions

Question

a. How will the leader be selected?

Answered: 1 week ago

Question

b. Will new members be welcomed?

Answered: 1 week ago