sicily 1007

860 단어 Stringinclude
#include "iostream" #include "string" #include <algorithm>//  reverse  ,         ! using namespace std; int main() { int n, length; string str; while (cin >> n )//  columns { if (n != 0) { cin >> str;//      length = str.size(); int row = length / n;//  new string      string *str1 = new string [row]; for (int j = 0, i = 0; j < length && i < row; j++)//              { str1[i] += str[j]; if (j !=0 && ((j + 1)% n == 0)) i++; } for (int i = 1; i < row; i = i + 2) reverse(str1[i].begin(), str1[i].end());//       string str2 = ""; for (int i = 0; i < n; i++)//                for (int j = 0; j < row; j++) { str2.push_back(str1[j][i]); } cout << str2 << endl; } else break; } }

좋은 웹페이지 즐겨찾기