Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. int main()
  2. {
  3.   freopen("input.txt", "r", stdin);
  4.   freopen("output.txt", "w", stdout);
  5.   long long leng;
  6.   std::cin >> leng;
  7.   std::string arr[leng];
  8.   std::string temp;
  9.   long long length_of_leng = cnt_of_num(leng - 1);
  10.   for (long long it = 0; it < leng; ++it) {
  11.     std::cin >> temp;
  12.     if (stoll(temp) >= 0) {
  13.       for (long long i = 0; i < length_of_leng - cnt_of_num(it); ++i) { temp += "0"; }
  14.       temp += std::to_string(it);
  15.     }
  16.     else {
  17.       for ( long long i = 0; i < (length_of_leng - cnt_of_num(pow(10, length_of_leng) - it)); ++i) { temp += "0";  }
  18.       temp += std::to_string(pow(10, length_of_leng) - it);
  19.     }
  20.     arr[it] = temp;
  21.   }
  22.   //qs(arr, 0, leng - 1);
  23.   for (long long it = 0; it < leng; ++it) {
  24.     std::cout << stoll(arr[it]) / (long long)(pow(10, length_of_leng)) << " ";
  25.   }
  26.   std::cout << std::endl;
  27.   return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement