oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

message Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

message.html

Ben and Gwen have just received an important message from The Plumbers about an impending doom on the whole universe. However, as this is top secret information, The Plumbers have decided to crypt the message with a Rail Fence cipher. After all, you do not want the enemy to find out your secret plan, do you?

In the rail fence cipher, the plaintext is written downwards on successive "rails" of an imaginary fence, then moving up when we get to the bottom. The message is then read off in rows.

For example, an encrypted message “B0PE1HLUNES” with the rail fence height of 3 can be decoded as follows:

B . . . 0 . . . P . .
. E . 1 . H . L . U .
. . N . . . E . . . S

Reading the sequence from the top left hand corner then going diagonally down and up and down and up and down will give the decoded message:

“BEN10HELPUS”

As Ben and Gwen aren’t very good decoders, they have enlisted the help of you to come up with a program to help them decode the message from The Plumbers.

Given the rail height, n (1 ≤ n ≤ 100), and an encrypted message, output the decoded message.

Sample Input

3
B0PE1HLUNES

Sample Output

BEN10HELPUS

Tags

NOI 2011 Sec Selection Test 1

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
1100101s32MBAverage
2011s32MBAverage

Judge Compile Command

g++-8 ans.cpp -o message -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.