You are viewing a single comment's thread. Return to all comments →
without 2d array
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { int r,c; string s; cin>>s; int l=s.length(); r=floor(sqrt(l)); c=ceil(sqrt(l)); if((r*c)<l) r++; for(int i=0;i<c;i++) { for(int j=i;j<l;j+=c) { cout<<s[j]; } cout<<" "; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Encryption
You are viewing a single comment's thread. Return to all comments →
without 2d array