Programming contests

ICPC programozó csapatverseny, házi forduló, 2019. október 30.

October 30, 2019, 10:00 AM – October 30, 2019, 3:00 PM

Good Morning!

Good morning! This is your 5am wake-up call! A partly cloudy day is expected with light rain coming afternoon…

You have just woken up. You desperately need coffee… and… more coffee… and some cereal. And your clothes. And coffee.

To prepare warm cereal, you put some milk into a microwave, trying to heat it for k seconds. You must enter k on the microwave keyboard:

As you still haven't had your coffee, your hand (along with eyes and brain) keeps falling down. You are only able to enter a number if your hand only moves downwards and/or to the right. You cannot go back left, nor move your hand up, though you can press the same key again. And again… and again…

For example, you can enter the number 180 or 49, but not 98 or 132. Enter a number that is as close to k as possible. If there are two solutions, enter any one of them. You are too sleepy to actually care. And you need coffee.

Input Specification

The first line of the input contains the number of test cases T. The descriptions of the test cases follow:

Each test case consists of one line containing an integer k (1 ≤ k ≤ 200).

Output Specification

For each test case, output a number that is closest to k and can be entered on the keyboard.

Sample Input

  1. 3
  2. 180
  3. 83
  4. 132
download as text file

Output for Sample Input

  1. 180
  2. 80
  3. 133
download as text file

Original Problem

Central Europe Regional Contest, 2014

University of Debrecen; Faculty of Informatics; v. 09/30/2024