Advertisement
Guest User

b

a guest
Nov 18th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. #include<iostream>
  2. #include<functional>
  3. #include<bitset>
  4. #include<algorithm>
  5. #include<fstream>
  6. #include<string>
  7. #include<stdio.h>
  8. #include<iomanip>
  9. #include<sstream>
  10. #include<cmath>
  11. #include<vector>
  12. #include<queue>
  13. #include<deque>
  14. #include<stack>
  15. #include<set>
  16. #include<map>
  17. typedef unsigned long long ull;
  18. typedef long long ll;
  19. typedef long double ld;
  20. #define PI 3.14159265
  21. #define eps 1e-8
  22.  
  23. using namespace std;
  24.  
  25. void fast(){
  26.     ios_base::sync_with_stdio(0);
  27.     cin.tie(NULL), cout.tie(NULL);
  28. }
  29.  
  30. int main()
  31. {
  32.     string s;
  33.     cin >> s;
  34.     int stroka = ceil(s.length()/20.0);
  35.     int stolbec = ceil(s.length()/(float)stroka);
  36.     cout << stroka << " " << stolbec << endl;
  37.     int dl = stroka*stolbec;
  38.     int zv = dl - s.length();
  39.     char **a;
  40.     a = new char*[stroka];
  41.     for (int i=0; i<stroka; i++)
  42.     {
  43.         a[i] = new char[stolbec];
  44.     }
  45.     for (int i=0; i<stroka; i++)
  46.     {
  47.         for (int j=0; j<stolbec; j++)
  48.         {
  49.             a[i][j]='0';
  50.         }
  51.     }
  52.     int str=0;
  53.     int stb=0;
  54.     while (zv>0)
  55.     {
  56.         a[str][stb]='*';
  57.         zv--;
  58.         str++;
  59.         if (str == stroka-1)
  60.         {
  61.             str=0;
  62.             stb++;
  63.         }
  64.     }
  65.     int kk=0;
  66.     for (int i=0; i<stroka; i++)
  67.     {
  68.         for (int j=0; j<stolbec; j++)
  69.         {  
  70.             if (a[i][j]!='*')
  71.             {
  72.                 cout << s[kk++];
  73.             }
  74.             else cout << a[i][j];
  75.         }
  76.         cout << endl;
  77.     }
  78.     return 0;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement