CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » Online C » Cipher

Cipher

Problem code: CS06

  • All Submissions

Problem text... Orders have been sent from the head quarters to submarine to MOVE SOUTH WEST TO 30 KM , but the message is in encoded (Encrypted) form. As M has ASCII code of 77, but they added 1(i.e. key) in it, then M became 77+1 i.e. N. So the entire message is in encrypted form i.e. our hackers has stolen the following line NPWF!TPVUI!XFTU!UP!41LN . The key can be from -30 to 115. The value of key is not known and we got another message from our hackers. The problem is to find the key, and only thing that you know the word CRAZY BLACK CAT which is the part of the string some where in it.

Input

Input description... 1) Encrypted message received: SPZ[LU3 [OL JYHa ISHJR JH['Z[VW ^OLYL V\ HYL 2) Known sub string CRAZY BLACK CAT

Output

Output description... 1) Key=7 2) Message= LISTEN, THE CRAZY BLACK CAT STOP WHERE YOU ARE Note: There will be multiple test cases and the input will end on the line containing a single 0.

Example

Input:
NPWF!TPVUI!XFTU!UP!41LN
WEST TO
SPZ[LU3   [OL   JYHa    ISHJR   JH['Z[VW   ^OLYL    V\   HYL
CRAZY BLACK CAT
0

Output:
MOVE SOUTH WEST TO 30 KM
LISTEN, THE CRAZY BLACK CAT STOP WHERE YOU ARE


Author: rushikesh30
Date Added: 14-02-2010
Time Limit: 1 sec
Source Limit: 50000 Bytes
Languages: ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC


  • Submit

Comments

  • Login or Register to post a comment.

if space character will be

codegambler @ 21 Feb 2010 07:48 AM

if space character will be encripted or not if so then how second sample input have space and same place sample output have also space? (space ASCII = 32 hence in encripted text it should be 32+7 = 39)?

resubmit all your solutions..

rushikesh30 @ 21 Feb 2010 01:08 PM

resubmit all your solutions..

What is the output

ccoder4u @ 21 Feb 2010 04:23 PM

What is the output format??

output description is different from output.

Administrator could u plzz

ccoder4u @ 21 Feb 2010 04:50 PM

Administrator could u plzz what is problem with my solution

hey the output description

Shanky @ 21 Feb 2010 06:38 PM

hey the output description and output is conflicting

I'm just taking the input and

long_road @ 21 Feb 2010 10:58 PM

I'm just taking the input and its exceeding the time limit.

Normal 0 false

Silly Rabit @ 21 Feb 2010 11:41 PM

<!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} span.EmailStyle15 {mso-style-type:personal; mso-style-noshow:yes; mso-style-unhide:no; mso-ansi-font-size:11.0pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

The output description and output do not match.  Can you please tell us what the output is supposed to look like.

Also, the input description's Encrypted message (SPZ[LU3 [……) contains single spaces, whereas in the input at the bottom it contains multiple spaces. Which is the correct one? Yes, it makes a huge difference in the code.

oops!   The output

Silly Rabit @ 21 Feb 2010 11:42 PM

oops!

 

The output description and sample do not match.  Can you please tell us what the output is supposed to look like.

Also, the  input description the Encrypted message (SPZ[LU3 [……) contains single spaces, whereas in the input at the bottom contains multiple spaces.  Which is the correct one?  Yes, it makes a  huge difference in the code.

Sumit I tried a order n

sam83 @ 21 Feb 2010 11:48 PM

Sumit I tried a order n algorithm, it gave TLE.

Finally, i tried the most optimal solution, let me show you the solution even ;)

 

 

#include<stdio.h>
int main() {
return 0;
}
~
~

it gives TLE.

Admin!!!!!!!!!!!!!!!!!!, Can

sam83 @ 21 Feb 2010 11:49 PM

Admin!!!!!!!!!!!!!!!!!!, Can you check your input output.

I think they have missed the

alok @ 22 Feb 2010 02:41 PM

I think they have missed the ` in the second input, as when I tested it on my code which was also giving TLE, the encoded was:

 

LISTEN, THE CRAZY BLACK CAT STOP WHERE YOU ARE
SPZ[L
SPZ[LU3`[OL`JYHa`ISHJR`JH[`Z[VW`^OLYL`V`HYL

SPZ[LU3`[OL`JYHa`ISHJR`JH[`Z[

alok @ 22 Feb 2010 02:43 PM
SPZ[LU3`[OL`JYHa`ISHJR`JH[`Z[VW`^OLYL`V`HYL

when ranklist will be

long_road @ 22 Feb 2010 06:11 PM

when ranklist will be uploaded

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com