To and Fro
来源:互联网 发布:数据录入员有前途吗 编辑:程序博客网 时间:2024/06/08 07:20
// http://www.spoj.com/problems/TOANDFRO/#include <iostream>#include <string>#include <cstring>using std::cin;using std::cout;using std::endl;using std::string;using std::memset;int main(int argc, char* argv[]) {int cols;char result[200];cin >> cols;while (cols != 0) {string encryptedText;cin >> encryptedText;int rows = encryptedText.size() / cols;memset(result,0,200);int position = 1;int offset = rows;int index = 0;for (int i = 0; i < rows; i++) {for (int j = 0; j < cols; j++) {result[position-1] = encryptedText[index++];position += offset;}position += 1;position -= offset;offset = -offset;}cout << result;cout << endl;cin >> cols;}}
0 0
- sicily1007. To and Fro
- 1007. To and Fro
- 1007. To and Fro
- zoj2208--------------------To and Fro
- 1007. To and Fro
- To and Fro
- To and Fro
- HDU1200:To and Fro
- 1007[To and Fro]
- To and Fro
- 1007. To and Fro
- sicily1007. To and Fro
- hdu_1200 To and Fro
- 1547. To and Fro
- HDU1200 To and Fro
- 1007. To and Fro
- 1200 To and Fro
- To and Fro
- 简单搜索(数独)poj 2676 Sudoku
- GitHub操作之删除repo
- 核心电路芯片中作用
- JUCE UI framework
- Python logo面向对象编程语言 Python
- To and Fro
- ubuntu 无法应用原保存的显示器配置
- AOP技术基础
- 设计模式思考和拾遗(学习笔记和思考,持续更新)
- 黑马程序员——throw和throws的区别
- net use命令详解
- ARM ABI总体概述
- ACM寒假培训——各种排序
- 黑马程序员——数组和集合的主要区别