#include <iostream>
#include <bits/stdc++.h>
|
#define | ull unsigned long long |
|
#define ull unsigned long long |
9 string enc_message =
"", str;
10 ull len ,i ,j ,k ,l, row, col;
11 string enc_matrix[100];
14 istringstream istream(str);
15 for(
string s; istream >> s;) {
20 col = enc_matrix[0].size();
22 pair<ull,ull> dim = make_pair(row,col);
23 ull c_count = 0, max_r = dim.first-1, min_c = 0, min_r = 0, max_c = dim.second-1;
26 while(c_count < len) {
27 for(i = min_r; i <= max_r;++i) {
28 if(c_count == len) {
break;}
29 enc_message+= enc_matrix[i][max_c];
34 for(j = max_c-1;j>=min_c;--j) {
35 if(c_count == len) {
break;}
36 enc_message+= enc_matrix[max_r][j];
38 if(j == min_c){
break;}
42 for(k = max_r-1;k>=min_r;--k) {
43 if(c_count == len) {
break;}
44 enc_message+= enc_matrix[k][min_c];
46 if(k == min_r){
break;}
49 for(l = min_c + 1;l<=max_c -1;++l) {
50 if(c_count == len) {
break;}
51 enc_message+= enc_matrix[min_r][l];
60 cout << enc_message <<endl;
#define ull
Definition: decr_routeCipher.cpp:7