You are not logged in. Please login at www.codechef.com to post your questions!

×

TABLET - Editorial

Tester: Michael Nematollahi
Editorialist: Hussain Kara Fallah

Cakewalk

NONE

PROBLEM:

Chef has visited some tablet shops and listed all of his options. In total, there are $N$ available tablets, numbered $1$ through $N$. For each valid $i$, the $i_{th}$ tablet has width $W_i$, height $H_i$ and price $P_i$.

Chef's budget is equal to $B$. He wants to buy the tablet with the largest screen (largest area) as long as its price fits with in the budget.

EXPLANATION:

This problem is a straightforward implementation. Read all the information about the tablets. The screen area of a tablet is equal to the screen's width multiplied by the screen's height. Iterate through all tablets and check for each one if its price is less than or equal to $B$. If so, compare its area to the answer and update the answer to the maximum of them.

To fully understand, it's better to check one of the implementations attached below.

AUTHOR'S AND TESTER'S SOLUTIONS:

TESTER's solution

This question is marked "community wiki".

asked 17 Feb, 19:09

1181234
accept rate: 0%

19.8k350498541

 0 Video Editorial : https://youtu.be/4sc_dNmcqeg answered 18 Feb, 21:26 1 accept rate: 0%
 toggle preview community wiki:
Preview

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×15,852
×1,688
×968
×850
×43

question asked: 17 Feb, 19:09

question was seen: 612 times

last updated: 18 Feb, 21:26