Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #include <ext/pb_ds/assoc_container.hpp>
  4. #include <ext/pb_ds/tree_policy.hpp>
  5.  
  6. #pragma GCC optimize("O3")
  7.  
  8. using namespace std;
  9. using namespace __gnu_pbds;
  10.  
  11. //#define int long long
  12. #define double long double
  13. #define _ << ' ' <<
  14. #define For(i,z) for(int32_t i=0;i<(z);i++)
  15. #define sqr(a) ((a)*(a))
  16.  
  17. #define pii pair<int, int>
  18. #define pdd pair<double, double>
  19. #define f first
  20. #define s second
  21.  
  22. template<typename T>
  23. using orset = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  24.  
  25. template<typename T, typename K>
  26. using ormap = tree <T, K, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  27.  
  28. template<typename T, typename K> inline void umax(T &a, K b) { a = max(a, (T)b); }
  29. template<typename T, typename K> inline void umin(T &a, K b) { a = min(a, (T)b); }
  30. mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
  31.  
  32. const int32_t N = 1e6+10;
  33. const int64_t INF = 1e15;
  34. const pair<int64_t, int64_t> PINF = make_pair(INF, INF);
  35. const double EPS = 1e-7;
  36. const int64_t MOD1 = 99989;
  37. const int64_t MOD2 = 99991;
  38. const int64_t AMOD = 99194853094755497;
  39. const double PI = 3.14159265359;
  40.  
  41. pii dp[N][26];
  42.  
  43. int32_t main() {
  44. //freopen("input.txt", "r", stdin);
  45. ios_base::sync_with_stdio(false);
  46. cin.tie(0); cout.tie(0);
  47.  
  48. int k; cin >> k;
  49. string s;
  50. s = "a";
  51. while (k > 0) {
  52. if (s.back() == 'a')
  53. s += 'z';
  54. else
  55. s += 'a';
  56. k -= 25;
  57. }
  58. For (i, s.size()-1) {
  59. if (s[i] == 'z') {
  60. int cc = min((-k)/2, (int)'z' - 'a');
  61. s[i] -= cc;
  62. k += cc * 2;
  63. if (k >= 0) break;
  64. }
  65. }
  66. if (k > 0) {
  67. if (s.back() == 'z')
  68. s.back() -= k;
  69. else
  70. s.back() += k;
  71. } else {
  72. if (s.back() == 'z')
  73. s.back() += k;
  74. else
  75. s.back() -= k;
  76.  
  77. }
  78. cout << s << endl;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement