fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define endl "\n"
  4. #define F first
  5. #define S second
  6. #define loop(a,n) for(int i=a; i<=n ; i++)
  7. #define TIME (1.0 * clock() / CLOCKS_PER_SEC)
  8. #define NAME "B99E"
  9. using namespace std;
  10.  
  11. int dem(ll x) {
  12. return to_string(x).size();
  13. }
  14.  
  15. int main(){
  16. ios_base::sync_with_stdio(0);
  17. cin.tie(0); cout.tie(0);
  18. //freopen(NAME".INP", "r", stdin);
  19. //freopen(NAME".OUT", "w", stdout);
  20. int b, e;
  21. while (cin >> b >> e) {
  22. bool tim = false;
  23. for (int len = 1; len <= 50; len++) {
  24. ll pow10 = 1;
  25. for (int i = 0; i < len + 1; i++) pow10 *= 10;
  26. ll tu = b * pow10 + e;
  27. if (tu % 89 != 0) continue;
  28. ll n = tu / 89;
  29. if (dem(n) == len) {
  30. cout << n << endl;
  31. tim = true;
  32. break;
  33. }
  34. }
  35. if (!tim) cout << 0 << endl;
  36. }
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty