poj 3128 Leonardo's Notebook
来源:互联网 发布:期货农产品数据库建立 编辑:程序博客网 时间:2024/06/17 16:30
Description
— How do you know it is genuine?
— Oh, it must be, at that price. And it is written in the da Vincicode. Sarah browsed a few of the pages. It was obvious to her thatthe code was a substitution cipher, where each letter of thealphabet had been substituted by another letter.
— Leonardo would have written the plain-text and left it to hisassistant to encrypt, she said. And he must have supplied thesubstitution alphabet to be used. If we are lucky, we can find iton the back cover! She turned up the last page and, lo and behold,there was a single line of all 26 letters of the alphabet:
QWERTYUIOPASDFGHJKLZXCVB
— This may be Leonardo's instructions meaning that each A in theplain-text was to be replaced by Q, each B withW, etcetera. Let ussee... To their disappointment, they soon saw that this could notbe the substitution that was used in the book. Suddenly, Stanbrightened.
— Maybe Leonardo really wrote the substitution alphabet on the lastpage, and by mistake his assistant coded that line as he had codedthe rest of the book. So the line we have here is the result ofapplying some permutation TWICE to the ordinary alphabet! Sarahtook out her laptop computer and coded fiercely for a few minutes.Then she turned to Stan with a sympathetic expression.
— No, that couldn't be it. I am afraid that you have been dupedagain, my friend. In all probability, the book is a fake.
Write a program that takes a permutation of the English alphabet asinput and decides if it may be the result of performing somepermutation twice.
Input
Output
Sample Input
2QWERTYUIOPASDFGHJKLZXCVBNMABCDEFGHIJKLMNOPQRSTUVWX YZ
Sample Output
NoYes
Source
program pku_3128;
vard:array[1..26] of longint;
begin
end.
- poj 3128 Leonardo's Notebook
- POJ 3128 Leonardo's Notebook
- 【POJ 3128】Leonardo's Notebook
- POJ 2262 Goldbach's Conjecture(…
- A Bug's Life -Poj
- poj 2528 Mayor's posters
- poj 3128 Leonardo's Notebook (置换群)
- POJ 3128 Leonardo's Notebook(置换)
- poj 3128 Leonardo's Notebook (置换)
- POJ 3128 Leonardo's Notebook 笔记
- POJ 3006 Dirichlet's Theorem on …
- hdu 1157 Who's in the Middle(poj…
- poj 1665 Biker's Trip Odometer
- poj 2488 A Knight's Journey
- HDOJ 4337 King Arthur's Knigh…
- HDU 1162 Eddy's picture
- uva 10010 - Where's Waldorf?
- poj 2960 S-Nim(博奕)
- Splay Tree
- poj 3468 A Simple Problem with I…
- [JSOI2008]火星人prefix
- [Ahoi2009]fly 飞行棋
- poj 2387 Til the Cows Come Home
- poj 3128 Leonardo's Notebook
- 多米诺覆盖
- Charm Bracelet
- poj 3093 Margaritas on the River…
- poj 1276 Cash Machine
- poj 1742 Coins
- poj 1014 Dividing
- poj 2777 Count Color
- poj 3254Corn Fields