102101: [AtCoder]ABC210 B - Bouzu Mekuri
Description
Score : $200$ points
Problem Statement
We have a deck of $N$ cards.
Each of these cards is good or bad.
Using this deck, Takahashi and Aoki will play a game against each other.
In the game, the players alternately draw the topmost card and eat it.
The player who first gets to eat a bad card loses the game. (Here, it is guaranteed that the deck contains at least one bad card.)
You are given a string $S$ consisting of 0
and 1
. For each $i = 1, 2, \ldots, N$,
- if the $i$-th character of $S$ is
0
, it means that the $i$-th card from the top of the deck is good; - if the $i$-th character of $S$ is
1
, it means that the $i$-th card from the top of the deck is bad.
Which player will lose when Takahashi goes first in the game?
Constraints
- $1 \leq N \leq 10^5$
- $N$ is an integer.
- $S$ is a string of length $N$ consisting of
0
and1
. - $S$ contains at least one occurrence of
1
.
Input
Input is given from Standard Input in the following format:
$N$ $S$
Output
Print the name of the player who will lose when Takahashi goes first in the game: Takahashi
or Aoki
.
Sample Input 1
5 00101
Sample Output 1
Takahashi
First, Takahashi will eat a good card. Next, Aoki will eat a good card. Then, Takahashi will eat a bad card.
Thus, Takahashi will be the first to eat a bad card, so we should print Takahashi
.
Sample Input 2
3 010
Sample Output 2
Aoki
Input
题意翻译
输入一个长为 $n$ 的 $01$ 串 $s$ ,求 $s$ 中从左往右数的第一个 $1$ 出现在第奇数个位置上还是第偶数个位置上(串中的第一个数为第 $1$ 位)。若在奇数位上输出Takahashi,否则输出Aoki。保证串中至少有一个 $1$ 。Output
问题描述
我们有一副包含$N$张卡片的牌组。
这些卡片中每张要么是好牌,要么是坏牌。
使用这副牌,Takahashi 和 Aoki 将要进行一场比赛。
在游戏中,玩家交替抽取并吃掉最上面的牌。
第一个吃到坏牌的玩家将输掉比赛。(这里保证牌组中至少有一张坏牌)。
给你一个由0
和1
组成的字符串$S$。对于每个$i = 1, 2, \ldots, N$,
- 如果$S$的第$i$个字符是
0
,表示从牌组顶部算起的第$i$张牌是好牌; - 如果$S$的第$i$个字符是
1
,表示从牌组顶部算起的第$i$张牌是坏牌。
当Takahashi在比赛中先手时,哪个玩家会输掉比赛?
限制条件
- $1 \leq N \leq 10^5$
- $N$是一个整数。
- $S$是一个长度为$N$的字符串,由
0
和1
组成。 - $S$中至少包含一个
1
。
输入
标准输入提供如下格式的数据:
$N$ $S$
输出
打印Takahashi在比赛中先手时会输掉比赛的玩家的名字:Takahashi
或Aoki
。
样例输入1
5 00101
样例输出1
Takahashi
首先,Takahashi会吃掉一张好牌。然后,Aoki会吃掉一张好牌。接着,Takahashi会吃掉一张坏牌。
因此,Takahashi会第一个吃到坏牌,所以我们应该打印Takahashi
。
样例输入2
3 010
样例输出2
Aoki