#include <stdio.h>
//密码
#define PASSWORD "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:/nuwloca-O;m .vpbks,fxntdCeghiry"
//密文
#define CODE "@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#/;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l /q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# /){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' /iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c /;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')# /}'+}##(!!/"
void ECodingChar(int n);//将一个字符解码
void ECodingWord(char *a,char end);//将一个字符串解码,end是结束字符串的字符
void ECodingByNum(int num,char end);//解码密文中第num个字符串字符串以end结尾
main(int t,int n,char *a)
{
/// 1
if(t == 1)
{
main(2,2,"任何字符都行");
}
/// 2
///用于输出每一行的第一句
///如On the first day of Christmas my true love gave to me
/// On the second day of Christmas my true love gave to me
/// .......
if(t == 2)
{
ECodingByNum(0,'/');//输出 On the
ECodingByNum(1-n,'/');//输出 first 或者 second 或者 ....
ECodingByNum(-13,'/');//输出 day of Christmas my true love gave to me
}
// 1 -- +无穷大
if(1<t)
{
if(t<n)
main(t+1,n,a);
ECodingByNum(-27+t,'/');
if(t == 2 && n<13)
main(2,n+1,"任何字符都行");
}
}
void ECodingChar(int n)
{
int i=0;
char *b = PASSWORD;
while(1)
{
if(n==b[i])
{
putchar(b[i+31]);
break;
}
i++;
}
}
void ECodingWord(char *a,char end)
{
char * b = a;
while(*b != end)
{
ECodingChar(*b);
b++;
}
}
void ECodingByNum(int num,char end)
{
int i = num;
char * a= CODE;
while(i<0)
{
if(*a == end) i++;
a++;
};
ECodingWord(a,end);
}
/*原文
On the first day of Christmas my true love gave to me
a partridge in a pear tree.
On the second day of Christmas my true love gave to me
two turtle doves
and a partridge in a pear tree.
On the third day of Christmas my true love gave to me
three french hens, two turtle doves
and a partridge in a pear tree.
On the fourth day of Christmas my true love gave to me
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the fifth day of Christmas my true love gave to me
five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the sixth day of Christmas my true love gave to me
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the seventh day of Christmas my true love gave to me
seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the eigth day of Christmas my true love gave to me
eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the ninth day of Christmas my true love gave to me
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the tenth day of Christmas my true love gave to me
ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the eleventh day of Christmas my true love gave to me
eleven pipers piping, ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the twelfth day of Christmas my true love gave to me
twelve drummers drumming, eleven pipers piping, ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
*/