Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created May 17, 2019 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/2b0a072cf13bcb93daab36f3ffb28503 to your computer and use it in GitHub Desktop.
Save whatalnk/2b0a072cf13bcb93daab36f3ffb28503 to your computer and use it in GitHub Desktop.
AtCoder ABC #100 B - Ringo's Favorite Numbers
#include <iostream>
using namespace std;
static int D, N;
int solve();
int ndiv(int x);
int ndiv(int x) {
int cnt = 0;
while (true) {
if (x % 100 == 0) {
x /= 100;
cnt++;
} else {
break;
}
}
return cnt;
}
int solve() {
int cnt = 0;
int x = 1;
while (true) {
int nn = ndiv(x);
if (nn == D) {
cnt++;
}
if (cnt == N) {
break;
}
x++;
}
return x;
}
int main() {
cin >> D >> N;
cout << solve() << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment