QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 32 MB 満点: 100

#16406. SLOM

統計

小 Marin 整天都在为 COCI 生成测试数据。他怎么也搞不定,以至于精神崩溃,甚至连东西都看不清了。每次他在阅读时眨眼,单词中的字母就会混在一起,使得单词后半部分的字母(如果长度为奇数,则为较短的那一半)按以下方式“插入”到前半部分的字母之间:

  • 最后一个字母“插入”到第一个和第二个字母之间
  • 倒数第二个字母“插入”到第二个和第三个字母之间
  • 倒数第 $k$ 个字母“插入”到正数第 $k$ 个和第 $k+1$ 个字母之间

例如,单词 "abcdef" 在眨眼一次后会变成 "afbecd"。

如果 Marin 再次眨眼,会发生同样的事情。眨眼两次后,单词 "abcdef" 变成 "adfcbe"。

Marin 决定写一个程序来帮助他确定屏幕上到底写了什么。不幸的是,工作了一天之后,他实在太累了,需要你的帮助。给你 Marin 眨眼的次数 $X$ 以及他在屏幕上看到的单词。请编写一个程序为 Marin 揭开谜底,并确定在他眨眼 $X$ 次之前,原本的单词是什么。

输入格式

输入的第一行包含一个正整数 $X$($1 \le X \le 1\,000\,000\,000$),表示 Marin 眨眼的次数。

输入的第二行包含屏幕上的单词,其长度在区间 $[3, 1000]$ 内。该单词仅由英文小写字母组成。

输出格式

输出的第一行也是唯一一行必须包含在 Marin 眨眼 $X$ 次之前的原始单词。

子任务

在价值 50 分的测试数据中,$X \le 100$。

样例

输入样例 1

4
acefdb

输出样例 1

abcdef

输入样例 2

1000
aaaaaa

输出样例 2

aaaaaa

输入样例 3

11
srama

输出样例 3

sarma

说明

第一个样例的解释:单词按以下顺序变化:abcdef $\to$ afbecd $\to$ adfcbe $\to$ aedbfc $\to$ acefdb

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.