diff --git a/Luogu/P1980/P1980.cpp b/Luogu/P1980/P1980.cpp new file mode 100644 index 00000000..6ddae879 --- /dev/null +++ b/Luogu/P1980/P1980.cpp @@ -0,0 +1,23 @@ +#include + +using namespace std; + +int n, x, ans; + +int cntx(int num) { + int res = 0; + while (num) { + res += num % 10 == x; + num /= 10; + } + return res; +} + +int main() { + cin >> n >> x; + for (int i = 1; i <= n; i++) { + ans += cntx(i); + } + cout << ans << endl; + return 0; +}