#include <iostream>
#include <bits/stdc++.h>
|
#define | ull unsigned long long |
|
#define ull unsigned long long |
11 for(i=2;i<=len; i++) {
#define ull
Definition: routecipher.cpp:7
23 cout << enc_message.size() <<endl;
24 ull len = enc_message.size() ,i ,j ,k ,l;
25 pair<ull,ull> dim =
getRC(len);
26 cout << dim.first <<
" " << dim.second <<endl;
27 char enc_matrix[dim.first][dim.second];
29 ull c_count = 0, max_r = dim.first-1, min_c = 0, min_r = 0, max_c = dim.second-1;
31 while(c_count < len) {
32 for(i = min_r; i <= max_r;++i) {
33 if(c_count == len) {
break;}
34 enc_matrix[i][max_c] = (enc_message[c_count]);
39 for(j = max_c-1;j>=min_c;--j) {
40 if(c_count == len) {
break;}
41 enc_matrix[max_r][j] = (enc_message[c_count]);
43 if(j == min_c){
break;}
47 for(k = max_r-1;k>=min_r;--k) {
48 if(c_count == len) {
break;}
49 enc_matrix[k][min_c] = (enc_message[c_count]);
51 if(k == min_r){
break;}
54 for(l = min_c + 1;l<=max_c -1;++l) {
55 if(c_count == len) {
break;}
56 enc_matrix[min_r][l] = (enc_message[c_count]);
59 cout << c_count << endl;
65 for(i=0;i<dim.first;i++) {
66 for(j=0;j<dim.second;j++)
67 cout << enc_matrix[i][j];
pair< ull, ull > getRC(ull len)
Definition: routecipher.cpp:8
#define ull
Definition: routecipher.cpp:7