IGRUS and the Restroom
Time limit1sMemory limit1024 MB
Given the floor K and the mascot's body size, find the nearest floor with a restroom that fits it: odd floors for Annyong, even floors for Induck.
- Level
Easy1 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
IGRUS is short for Inha Group of Research for Unix Security, an academic student club under the Jeongtongcheo that started in 2000. The IGRUS clubroom is a two-story space with floors numbered 1 to . Odd-numbered floors have a restroom for large animals, and even-numbered floors have a restroom for small animals.
Inha University's mascots are Annyong, a dragon, and Induck, a duck. A dragon is a large animal, and a duck is a small animal. Write a program for Annyong and Induck when they visit the IGRUS clubroom. When either one (Annyong or Induck) is on floor , the program finds the floor of the nearest restroom that fits its body size.
Input
The first line contains the number of floors of the IGRUS clubroom.
The second line contains annyong if the mascot is Annyong, or induck if the mascot is Induck.
The third line contains the floor where the mascot is currently located.
Output
Print one integer that is a valid answer to the problem.
If several integers are valid, any of them is accepted.
Constraints