QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21230. Kodierung durch eine Zeichenkettenfunktion

Statistics

Bessie entdeckt eine Funktion, die die ganze Herde auf Zeichenketten anwenden kann.

Für $N$ ($1\le N\le15$) und $S$ mit Länge strikt größer als $N$ verbindet $f(N,S)$ die Teilkette von Zeichen $N$ (0-basiert, erstes 0) bis zum Ende mit $S$ selbst, in dieser Reihenfolge.

Etwa $N=2$, $S=$ COW: $f(N,S)=$ W + COW = WCOW. Auch $f(3,\text{USACO})=$ CO + USACO = COUSACO.

Begeistert will sie iterieren: COW mit $N=2$ ergibt WCOW, erneut mit $N=2$ OWWCOW, nochmals WCOWOWWCOW.

Kodiere $Z$ Zeichenketten ($1\le Z\le100$), $str_1,str_2,\ldots$, Länge $2..100$, nur Großbuchstaben. Jede hat $N_i$ ($0\le N_i<\operatorname{length}(str_i)$) und $C_i$ Iterationen ($1\le C_i\le12$).

Eingabe

  • Zeile 1: ganze Zahl $Z$.
  • Zeilen $2..Z+1$: Zeile $i+1$ hat zwei ganze Zahlen durch Leerzeichen getrennt, ein Leerzeichen und die Kette: $N_i,C_i,str_i$.

Ausgabe

  • Zeilen $1,\ldots,Q$: Zeile $j$ enthält die iteriert kodierte $str_j$.

Beispiele

Eingabe 1

2
2 3 COW
3 2 USACO

Ausgabe 1

WCOWOWWCOW
SACOCOUSACO

Hinweis

Der Pfeil bezeichnet eine Iteration: COW -> WCOW -> OWWCOW -> WCOWOWWCOW; USACO -> COUSACO -> SACOCOUSACO.

Aufgabenautor: Lewin Gan, 2011

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.