Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define int64_t long long
- using namespace std;
- int n;
- namespace Sub1 {
- int d[202];
- bool check(int x) {
- int a = x;
- while(x) {
- int tmp = x % 10;
- x /= 10;
- if(tmp != 0 && a % tmp) return false;
- }
- return true;
- }
- void solve() {
- if(n == 0) cout << 1;
- else if(n == 1) cout << 10;
- else if(n == 2) cout << 33;
- else {
- int64_t k = 1;
- for(int i = 1; i <= n; ++i)
- k *= 10;
- int64_t ans = 33;
- for(int i = 100; i <= k; ++i)
- if(check(i)) ans++;
- cout << ans;
- }
- }
- } //namespace Sub1()
- int main() {
- #ifdef LOCAL
- //freopen("in.txt", "r", stdin);
- #else
- freopen("NDNUM.inp", "r", stdin);
- freopen("NDNUM.out", "w", stdout);
- #endif
- ios_base::sync_with_stdio(false);
- cin.tie(0); cout.tie(0);
- cin >> n;
- if(n <= 6)
- Sub1::solve();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement