【10639 Hello Kitty】
【問題描述】
Kitty sends a kind of original email messages to her friend Garf. To write a message, she chooses a word W and a number n and replicates W n times horizontally. Then she repeats this string in the next line, but rotating the characters once to the left. And she repeats this ‘rotateand- output’ process until the word W appears displayed as the first column of the rectangular pattern that she produces.
As an example, when she chooses the word Hello and the number 3, she gets the pattern:
HelloHelloHello
elloHelloHelloH
lloHelloHelloHe
loHelloHelloHel
oHelloHelloHell
Kitty has been sending such emails during the last three years. Recently, Garf told her that perhaps her work may be automatized with a software to produce Kitty’s patterns. Could you help her?
【輸入】
The input file contains several test cases, each one of them in a separate line. Each test case has a word and a positive integer that should generate the corresponding rectangular pattern. The word is a string of alphabetic characters (a…z). The number is less than 10.
A line whose contents is a single period character means the end of the input (this last line is not to be processed).
【輸出】
Output texts for each input case are presented in the same order that input is read. For each test case the answer must be a left aligned Kitty pattern corresponding to the input.
The output must be written to standard output.
【樣例輸入】
Love 1
Kitty 2
.
【樣例輸出】
Love
oveL
veLo
eLov
KittyKitty
ittyKittyK
ttyKittyKi
tyKittyKit
yKittyKitt
【題目大意】
簡化一下題目意思,首先輸入一個字符串,然后輸入一個整型數字,例如:Hello 2,則首先先輸出HelloHello,然后進行字符串的偏移,就是說下一個輸出的是elloHelloH,然后是lloHelloHe,依次類推,知道這個字符串下一次偏移將會變成自己,則停止,這個例子的話,就是到oHelloHell結束,另外如果輸入的字符串是“.”,不做處理,停止程序
【實現思路】
這個就很容易了,就是首先根據輸入的k創造出最原始的字符串,然后在進行一位一位的偏移的即可,判斷邊界條件即可
【實現代碼】
總結
以上是生活随笔為你收集整理的【10639 Hello Kitty】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python+django+vue+El
- 下一篇: Win10 LTSC2021输入法失效解