牛津大學(xué)編程思維挑戰(zhàn)(OUCC)是澳大利亞數(shù)學(xué)會(AMT)組織參與的信息學(xué)比賽之一。OUCC基于計算及算法思維CAT學(xué)術(shù)活動所使用的一些基本原則,并幫助學(xué)生加深發(fā)展用程序方法解決計算思維問題。所有題目使用模塊化語言來解決,更高年級的學(xué)生需要用編程語言來實現(xiàn)。該學(xué)術(shù)活動新賽季報名時間已公布,報名通道及學(xué)術(shù)活動真題開放中!
學(xué)術(shù)活動時間:
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
知識點:
列表的應(yīng)用
參考代碼:

想要獲取備賽計劃,考前查缺補漏、重點沖刺
歡迎前來掃描二維碼咨詢【免費領(lǐng)取】歷年學(xué)術(shù)活動真題及解析!


? 2026. All Rights Reserved. 滬ICP備2023009024號-1