Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define task "BAI2"
- #include <iostream>
- #include <cstdio>
- #include <cmath>
- using namespace std;
- using ll = long long;
- int a, b, k;
- void Read()
- {
- cin >> a >> b >> k;
- }
- void Solve()
- {
- if (k == 10)
- cout << 1;
- else
- {
- ll tmp = 10;
- for (int i = 1;; ++i, tmp *= 10)
- {
- if ((a * tmp * 10 + b) % (k - 10) == 0)
- if ((int)log10((a * tmp * 10 + b) / (k - 10)) + 1 == i)
- {
- cout << (a * tmp * 10 + b) / (k - 10);
- return;
- }
- }
- }
- }
- int32_t main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- if (fopen(task ".INP", "r"))
- {
- freopen(task ".INP", "r", stdin);
- freopen(task ".OUT", "w", stdout);
- }
- Read();
- Solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement