發布時間: Sept. 21, 2020, midnight 最後更新時間: Sept. 14, 2023, 11:49 p.m. 時間限制: 1000ms 記憶體限制: 128M
<h1>注意:水題警告</h1>
Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play tt matches of a digit game...
In each of tt matches of the digit game, a positive integer is generated. It consists of nn digits. The digits of this integer are numerated from 11 to nn from the highest-order digit to the lowest-order digit. After this integer is announced, the match starts.
Agents play in turns. Raze starts. In one turn an agent can choose any unmarked digit and mark it. Raze can choose digits on odd positions, but can not choose digits on even positions. Breach can choose digits on even positions, but can not choose digits on odd positions. The match ends, when there is only one unmarked digit left. If the single last digit is odd, then Raze wins, else Breach wins.
It can be proved, that before the end of the match (for every initial integer with nn digits) each agent has an ability to make a turn, i.e. there is at least one unmarked digit, that stands on a position of required parity.
For each of tt matches find out, which agent wins, if both of them want to win and play optimally.
First line of input contains an integer t (1≤t≤100) — the number of matches.
The first line of each match description contains an integer n (1≤n≤103) — the number of digits of the generated number.
The second line of each match description contains an n-digit positive integer without leading zeros.
For each match print 1, if Raze wins, and 2, if Breach wins.
4 1 2 1 3 3 102 4 2069
2 1 1 2