Created
May 17, 2019 15:39
-
-
Save whatalnk/2b0a072cf13bcb93daab36f3ffb28503 to your computer and use it in GitHub Desktop.
AtCoder ABC #100 B - Ringo's Favorite Numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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