Abby's Absolutes

면접 대비

시간 제한1초메모리 제한2048 MB

요약
각 요청 값에 대해 1까지의 거리와 N까지의 거리를 비교해 N에 더 가까우면 N을, 아니면 1을 출력한다. 거리가 같으면 1을 출력한다.
난이도

쉬움10점 중 2점

유형
구현, 수학, 배열, 완전 탐색
정답자
아직 제출이 없습니다

문제

Abby has offered to buy you some apples. However, she is very absolute about things.

You may ask her to buy a certain number of apples, but she may buy more apples if she figures that you want a lot of apples, or just buy one apple if she figures that you do not want very many apples. So, if the number of apples you want is closer to Abby's upper threshold than it is to 11, then she will buy a number of apples equal to her upper threshold. Otherwise, she will just buy one apple. If it is equally close to 11 and her upper threshold, she will just buy 11 apple.

You want to figure out the total number of apples Abby will buy for you after she takes one or more trips to the grocery store.

입력

The input will consist of two lines.

The first line will contain two space-separated integers. The first integer 1≤N≤10,0001 \leq N \leq 10\\,000 is the number of apples Abby will buy if she is buying a lot of apples. The second integer 1≤K≤1001 \leq K \leq 100 is the number of trips to the store Abby will take.

The second line will contain KK space-separated integers representing the number of apples you want to buy on each of Abby's trips to the store, with each of these integers being between 11 and NN, inclusive.

출력

Output KK space-separated integers representing the number of apples Abby will buy for you for each of her trips to the store.

예제2

  1. 예제 1

    입력
    5 5
    1 2 3 4 5
    
    예상 출력
    1 1 1 5 5
    
  2. 예제 2

    입력
    6 8
    1 5 4 2 5 4 6 4
    
    예상 출력
    1 6 6 1 6 6 6 6