牛津大学编程挑战赛(OUCC)-报名-真题1

牛津大学编程思维挑战(OUCC)是澳大利亚数学会(AMT)组织参与的信息学比赛之一。OUCC基于计算及算法思维CAT竞赛所使用的一些基本原则,并帮助学生加深发展用程序方法解决计算思维问题。所有题目使用模块化语言来解决,更高年级的学生需要用编程语言来实现。该竞赛新赛季报名时间已公布,报名通道及竞赛真题开放中!

竞赛时间:

2022年5月8日14:00-15:00(60 分钟)

Rail Fence Cipher:

The rail fence cipher first appeared in the US civil war. The message to be encrypted is written in a wavelike pattern, down, up, down, up, ... on a fixed number of lines or rails. The cipher text is then read horizontally, rail by rail.

Example:With three rails, the message KOOKABURRAS would be written down as

K A R

O K B R A

O U S

and the encrypted message would be KAROKBRAOUS.

Input format:

A string with 3 - 12 letters.

Output format:

A string of the same length.

Task:

Write a program that encrypts a message using the rail fence cipher.

Note: For Java (and similar) programs the grader expects the name of the main class to be: railfence

知识点:

列表的应用

参考代码:
牛津大学编程挑战赛(OUCC)真题分享01

想要获取备赛计划,考前查缺补漏、重点冲刺

欢迎前来扫描二维码咨询【免费领取】历年竞赛真题及解析!

翰林国际教育资讯二维码