Hello Kitty
2008-02-14 22:01
441 查看
FJNU.1945
Description
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 'rotate-and-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?
Input
The input 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
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.
Sample Input
Love 1
Kitty 2
.
Sample Output
Love
oveL
veLo
eLov
KittyKitty
ittyKittyK
ttyKittyKi
tyKittyKit
yKittyKitt
Source
Colombian National Programming Contest 2006 Warmup
My Program
#include<iostream>
#include<string.h>
#define N 255
using namespace std;
int main()
...{
char str
;
int i,j,n,k;
while(cin>>str)
...{
if(!strcmp(str,"."))
break;
n=strlen(str);
cin>>k;
for(i=0;i<n;i++)
...{
for(j=i;j<n;j++)
cout<<str[j];
for(j=1;j<k;j++)
cout<<str;
for(j=0;j<i;j++)
cout<<str[j];
cout<<endl;
}
}
return 0;
}
YOYO's Note:
它有多组测试数据……
以前用C写了,大概是因为不会用!=EOF,一直搞不懂为什么WA……
现在无意间写了while的输入……它就AC了……很纠结……
Description
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 'rotate-and-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?
Input
The input 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
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.
Sample Input
Love 1
Kitty 2
.
Sample Output
Love
oveL
veLo
eLov
KittyKitty
ittyKittyK
ttyKittyKi
tyKittyKit
yKittyKitt
Source
Colombian National Programming Contest 2006 Warmup
My Program
#include<iostream>
#include<string.h>
#define N 255
using namespace std;
int main()
...{
char str
;
int i,j,n,k;
while(cin>>str)
...{
if(!strcmp(str,"."))
break;
n=strlen(str);
cin>>k;
for(i=0;i<n;i++)
...{
for(j=i;j<n;j++)
cout<<str[j];
for(j=1;j<k;j++)
cout<<str;
for(j=0;j<i;j++)
cout<<str[j];
cout<<endl;
}
}
return 0;
}
YOYO's Note:
它有多组测试数据……
以前用C写了,大概是因为不会用!=EOF,一直搞不懂为什么WA……
现在无意间写了while的输入……它就AC了……很纠结……
相关文章推荐
- XAML 实例演示之九 – Hello Kitty 专卖店产品演示
- PyQt4 精彩实例分析* 实例1 Hello Kitty!
- Hello Kitty!
- XAML 实例演示之九 – Hello Kitty 专卖店产品演示
- Let 's Study C++ Here ,hello kitty!
- andorid 第二天 hello kitty
- 2491 Hello Kitty
- 真tm成Hello Kitty了
- andorid 第二天 hello kitty
- 秋老虎不发威,我当你是Hello Kitty
- Hello Kitty
- 袜子上的Hello kitty
- Hello Kitty微信主题很可爱?小心财产安全!
- fjnu 1945 Hello Kitty
- Hello Kitty
- 使用 CSS3 绘制 Hello Kitty
- 礼品中心网(www.giftcenter.cn) - Hello Kitty, Disney Mickey 米奇,Doraemon 哆啦A梦专卖店
- 牛大发了~美国12岁女孩自制"火箭"将Hello Kitty送上近太空
- 使用 CSS3 绘制 Hello Kitty
- XAML 实例演示之九 – 创建 Hello Kitty 专卖店产品演示