From 418b7eba57f2d06a141ef576e586ceff9eb05ad8 Mon Sep 17 00:00:00 2001 From: Jihoon Lee Date: Tue, 26 Mar 2024 23:12:24 +0900 Subject: [PATCH] Add 01681.cpp --- 01xxx/01681.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 01xxx/01681.cpp diff --git a/01xxx/01681.cpp b/01xxx/01681.cpp new file mode 100644 index 00000000..c8773dc7 --- /dev/null +++ b/01xxx/01681.cpp @@ -0,0 +1,28 @@ +#include +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; +} \ No newline at end of file