Skip to content

Commit

Permalink
Add 01681.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Mar 26, 2024
1 parent 67a47e4 commit 418b7eb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions 01xxx/01681.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <iostream>
using namespace std;

bool check(int n, int l) {
while (n) {
if (n % 10 == l) return true;
n /= 10;
}
return false;
}

int solve(void) {
int n, l; cin >> n >> l;

int i = 1;
while (n) {
if (!check(i++, l)) n--;
}
return i - 1;
}

int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);

cout << solve();
return 0;
}

0 comments on commit 418b7eb

Please sign in to comment.