QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 1024 MB Toplam puan: 100

#23875. Den nærmeste verdien

İstatistikler

Oppgavebeskrivelse

Du får gitt heltallene $X, L, R$. Blant heltallene fra og med $L$ til og med $R$, skriv ut det som har minst absoluttverdi av differansen til $X$. Det kan bevises at det finnes nøyaktig $1$ slikt heltall.

Begrensninger

  • $1 \le X \le 100\,000$.
  • $1 \le L \le R \le 100\,000$.

Inndata

Inndata gis fra standard inndata på følgende format:

X L R

Utdata

Blant heltallene fra og med $L$ til og med $R$, skriv ut det som har minst absoluttverdi av differansen til $X$.

Eksempel 1

Inndata

8 3 6

Utdata

6

Blant $3, 4, 5, 6$ er tallet med minst absolutt differanse til $8$ lik $6$. Derfor skrives $6$ ut.

Eksempel 2

Inndata

7 3 10

Utdata

7

Blant $3, 4, 5, 6, 7, 8, 9, 10$ er tallet med minst absolutt differanse til $7$ lik $7$. Derfor skrives $7$ ut.

Eksempel 3

Inndata

8 10 10

Utdata

10

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.