Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#pragma comment(linker, "/STACK:36777216")
- #include <algorithm>
- #include <bitset>
- #include <cassert>
- #include <cmath>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <iostream>
- #include <list>
- #include <map>
- #include <queue>
- #include <set>
- #include <string>
- #include <sstream>
- #include <vector>
- #include <complex>
- #include <ctime>
- #include <stack>
- //#include <bits/stdc++.h>
- //#include <ext/pb_ds/assoc_container.hpp>
- //#include <ext/pb_ds/tree_policy.hpp>
- using namespace std;
- //using namespace __gnu_pbds;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef vector<int> VI;
- typedef vector< VI > VVI;
- typedef pair<int, int> PII;
- typedef vector<PII> VPII;
- #define REP(i, n) for(int i = 0; i < (n); ++i)
- #define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
- #define FOR(i, x, y) for(int i = (x); i <= (y); ++i)
- #define RFOR(i, y, x) for(int i = (x); i >= (y); --i)
- #define SZ(a) (int)(a).size()
- #define ALL(a) (a).begin(),(a).end()
- #define SORT(a) sort(ALL(a))
- #define CLEAR(x) memset(x, 0, sizeof x);
- #define COPY(FROM, TO) memcpy(TO, FROM, sizeof TO);
- #define UNIQUE(c) SORT(c),(c).resize(unique(ALL(c))-(c).begin())
- #define pb push_back
- #define mk make_pair
- #define sqr(x) ((x)*(x))
- #define X first
- #define Y second
- //typedef tree<int, null_type, less<int>,
- // rb_tree_tag, tree_order_statistics_node_update> order_set;
- const long double PI = acos(-1.0);
- const double EPS = 1E-6;
- const int INF = 2 * (1e+9) + 1;
- const int MAXN = 3 * 100000001;
- const int MOD = (1e+9) + 7;
- ll n;
- int m[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
- pair<ll, ll> cc[1001];
- int main () {
- //freopen("digits.in", "r", stdin);
- //freopen("digits.out", "w", stdout);
- cin >> n;
- ll minn = INF * (1e+9);
- REP (i, 1100100) {
- int t = i, cnt = 0;
- while (t) {
- cnt += (t % 10);
- t /= 10;
- }
- cc[cnt].X++;
- cc[cnt].Y += i;
- if (cc[cnt].X == n) {
- cout << cc[cnt].Y;
- return 0;
- }
- }
- return 0;
- }
- /*
- 7 5
- + 7
- + 6
- + 5
- + 4
- - 3
- 10 10
- + 6
- + 10
- + 5
- - 10
- - 5
- - 6
- + 10
- + 3
- + 6
- + 3
- */
Advertisement
Add Comment
Please, Sign In to add comment