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

×

TABLET - Editorial

PROBLEM LINK:

Practice
Contest

Author: Hasan Jaddouh
Tester: Michael Nematollahi
Editorialist: Hussain Kara Fallah

DIFFICULTY:

Cakewalk

PREREQUISITES:

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:

AUTHOR's solution

TESTER's solution

This question is marked "community wiki".

asked 17 Feb, 19:09

deadwing97's gravatar image

3★deadwing97
1181234
accept rate: 0%

edited 18 Feb, 02:34

admin's gravatar image

0★admin ♦♦
19.8k350498541


Video Editorial : https://youtu.be/4sc_dNmcqeg

link

answered 18 Feb, 21:26

coding_simple's gravatar image

0★coding_simple
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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