fork download
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int k, r;
  7. cin >> k >> r;
  8.  
  9. for(int i = 1; i <= 9; i++){
  10. if(((k*i) - r) % 10 == 0 || (k*i) % 10 == 0){
  11. cout << i;
  12. return 0;
  13. }
  14. }
  15.  
  16. cout << 10;
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5392KB
stdin
117 3
stdout
9