链接:https://ac.nowcoder.com/acm/contest/33189/K
来源:牛客网
题目描述
See Problem N for PDF statements.
NIO is playing a new game. In this game, NIO has a sword with attack power represented by an integer A A A. Initially, A = 0 A=0 A=0. There are also nn enemies in the game. NIO has to kill them in order, which means NIO must kill the ( i − 1 ) − t h (i−1)-th (i−1)−th enemy before killing the i − t h i-th i−th enemy for each i ( 2 ≤ i ≤ n ) i (2\le i\le n) i(2≤i≤n). For the ii-th enemy, NIO can kill it if and only if
A ≡ i ( m o d n ) A\equiv i \pmod{n} A≡i(modn).
Fortunately, NIO can upgrade his sword at any moment for any number of times. Each time NIO upgrades his sword, he first chooses an integer x ( 0 ≤ x ≤ 9 )