Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, b, r, OK = 1, nr = 0, c, cop;
- cin >> n >> b >> r;
- while(OK != 0){
- c = 0;
- cop = nr;
- while(cop != 0){
- c = c + 1;
- cop = cop / 10;
- }
- if(c > n){
- cout << - 1;
- break;}
- if(c == n)
- if(nr % b == r){
- cout << nr;
- break;
- }
- nr = nr + 1;
- }
- if(OK == 0)
- cout << nr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement