X, N = map(int,input().split()) P = list(map(int,input().split())) P.sort() diff = 10**10 for p in range(102): if p in P: continue if abs(X-p) < diff: diff = abs(X-p) ans = p print (ans)
from collections import Counter import bisect N = int(input()) A = list(map(int,input().split())) cnt = Counter(A) A.sort() ans = 0 MX = 10**6 P = [0] * (MX+1) for a in A: if P[a]==0: for i in range(MX+1): x = a*i if x > MX: break P[x] = 1 if cnt[a]==1: ans+=1 print (ans)
H, W, K = map(int,input().split()) x1, y1, x2, y2 = map(int,input().split()) mp = [input() for _ in range(H)] INF = 10**10 dist = [[INF]*W for _ in range(H)] dist[x1-1][y1-1] = 0 q = deque() q.append((x1-1,y1-1)) # スタート地点をenqueue while(q): x, y = q.popleft() if x==x2-1and y==y2-1: print (dist[x2-1][y2-1]) exit() else: for dx, dy in dxdy: for i in range(1,K+1): nx = x + dx*i ny = y + dy*i ifnot (0<=nx<H and0<=ny<W) or mp[nx][ny]=='@': break if dist[nx][ny] <= dist[x][y]: break if dist[nx][ny] == INF: q.append((nx,ny)) dist[nx][ny] = dist[x][y] + 1 print(-1)