SHARE
TWEET

Untitled

a guest Feb 27th, 2020 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     string str;
  10.     int n;
  11.     cin>>n;
  12.     vector <int> nums(n);
  13.     for(int i = 0; i < n; i++){
  14.         cin>>nums[i];
  15.     }
  16.     getline(cin, str);
  17.     getline(cin, str);
  18.     vector <vector <char> > v(n);
  19.     int j = 0;
  20.     for(int i = 0; i < n; i++) {
  21.         for(int j = i; j < str.size(); j += n) {
  22.             v[nums[i]].push_back(str[j]);
  23.         }
  24.     }
  25.     cout << endl;
  26.     for(int row = 0; row < n; row++) {
  27.         for(int i = 0; i < v[row].size(); i++) {
  28.             cout << v[row][i];
  29.         }
  30.     }
  31.     return 0;
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top