Guest User

Untitled

a guest
Nov 8th, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. //#pragma comment(linker, "/STACK:36777216")
  2. #include <algorithm>
  3. #include <bitset>
  4. #include <cassert>
  5. #include <cmath>
  6. #include <cstdio>
  7. #include <cstdlib>
  8. #include <cstring>
  9. #include <iostream>
  10. #include <list>
  11. #include <map>
  12. #include <queue>
  13. #include <set>
  14. #include <string>
  15. #include <sstream>
  16. #include <vector>
  17. #include <complex>
  18. #include <ctime>
  19. #include <stack>
  20.  
  21. //#include <bits/stdc++.h>
  22. //#include <ext/pb_ds/assoc_container.hpp>
  23. //#include <ext/pb_ds/tree_policy.hpp>
  24.  
  25. using namespace std;
  26. //using namespace __gnu_pbds;
  27.  
  28. typedef long long ll;
  29. typedef unsigned long long ull;
  30. typedef vector<int> VI;
  31. typedef vector< VI > VVI;
  32. typedef pair<int, int> PII;
  33. typedef vector<PII> VPII;
  34.  
  35. #define REP(i, n) for(int i = 0; i < (n); ++i)
  36. #define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
  37. #define FOR(i, x, y) for(int i = (x); i <= (y); ++i)
  38. #define RFOR(i, y, x) for(int i = (x); i >= (y); --i)
  39. #define SZ(a) (int)(a).size()
  40. #define ALL(a) (a).begin(),(a).end()
  41. #define SORT(a) sort(ALL(a))
  42. #define CLEAR(x) memset(x, 0, sizeof x);
  43. #define COPY(FROM, TO) memcpy(TO, FROM, sizeof TO);
  44. #define UNIQUE(c) SORT(c),(c).resize(unique(ALL(c))-(c).begin())
  45. #define pb push_back
  46. #define mk make_pair
  47. #define sqr(x) ((x)*(x))
  48. #define X first
  49. #define Y second
  50. //typedef tree<int, null_type, less<int>,
  51. // rb_tree_tag, tree_order_statistics_node_update> order_set;
  52.  
  53. const long double PI = acos(-1.0);
  54. const double EPS = 1E-6;
  55. const int INF = 2 * (1e+9) + 1;
  56. const int MAXN = 3 * 100000001;
  57. const int MOD = (1e+9) + 7;
  58.  
  59. ll n;
  60. int m[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  61. pair<ll, ll> cc[1001];
  62. int main () {
  63. //freopen("digits.in", "r", stdin);
  64. //freopen("digits.out", "w", stdout);
  65. cin >> n;
  66. ll minn = INF * (1e+9);
  67. REP (i, 1100100) {
  68. int t = i, cnt = 0;
  69. while (t) {
  70. cnt += (t % 10);
  71. t /= 10;
  72. }
  73. cc[cnt].X++;
  74. cc[cnt].Y += i;
  75. if (cc[cnt].X == n) {
  76. cout << cc[cnt].Y;
  77. return 0;
  78. }
  79. }
  80. return 0;
  81. }
  82. /*
  83. 7 5
  84. + 7
  85. + 6
  86. + 5
  87. + 4
  88. - 3
  89.  
  90. 10 10
  91. + 6
  92. + 10
  93. + 5
  94. - 10
  95. - 5
  96. - 6
  97. + 10
  98. + 3
  99. + 6
  100. + 3
  101. */
Advertisement
Add Comment
Please, Sign In to add comment