QOJ.ac

QOJ

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

#21230. Mã hóa hàm chuỗi

Statistics

Bessie khám phá hàm mới cho cả đàn áp dụng vào chuỗi.

Với $N$ ($1\le N\le15$) và $S$ dài lớn hơn hẳn $N$, $f(N,S)$ nối chuỗi con từ ký tự $N$ (đánh số từ 0, đầu 0) tới cuối với chính $S$, theo thứ tự đó.

Ví dụ $N=2$, $S=$ COW: $f(N,S)=$ W + COW = WCOW. Cũng $f(3,\text{USACO})=$ CO + USACO = COUSACO.

Thích thú, cô muốn lặp: COW với $N=2$ cho WCOW, lần nữa với $N=2$ OWWCOW, lần nữa WCOWOWWCOW.

Mã hóa $Z$ chuỗi ($1\le Z\le100$), $str_1,str_2,\ldots$, dài $2..100$, chỉ chữ hoa. Mỗi chuỗi có $N_i$ ($0\le N_i<\operatorname{length}(str_i)$) và $C_i$ lần lặp ($1\le C_i\le12$).

Dữ liệu vào

  • Dòng 1: số nguyên $Z$.
  • Dòng $2..Z+1$: dòng $i+1$ có hai số nguyên cách nhau bởi dấu cách, dấu cách và chuỗi: $N_i,C_i,str_i$.

Dữ liệu ra

  • Dòng $1,\ldots,Q$: dòng $j$ có phiên bản lặp mã hóa của $str_j$.

Ví dụ

Dữ liệu vào 1

2
2 3 COW
3 2 USACO

Dữ liệu ra 1

WCOWOWWCOW
SACOCOUSACO

Ghi chú

Mũi tên chỉ một lần lặp hàm: COW -> WCOW -> OWWCOW -> WCOWOWWCOW; USACO -> COUSACO -> SACOCOUSACO.

Tác giả bài toán: 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.