Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n, b, r, OK = 1, nr = 0, c, cop;
  8. cin >> n >> b >> r;
  9. while(OK != 0){
  10. c = 0;
  11. cop = nr;
  12. while(cop != 0){
  13. c = c + 1;
  14. cop = cop / 10;
  15. }
  16. if(c > n){
  17. cout << - 1;
  18. break;}
  19. if(c == n)
  20. if(nr % b == r){
  21. cout << nr;
  22. break;
  23. }
  24. nr = nr + 1;
  25. }
  26. if(OK == 0)
  27. cout << nr;
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement