Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<set>
- using namespace std;
- const int N = 1e7 + 10, inF = 1e9;
- bool mark[N];
- int a, b, mod;
- set<pair<int, int > > s;
- int main() {
- ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
- cin >> a >> b >> mod;
- int p = inF % mod;
- for (int i = 0; i <= min(a, mod - 1); i++) {
- int k = (1LL * p * i) % mod;
- if ((mod - k) % mod > b) {
- cout << 1 << ' ';
- int x = i, d = 0;
- while (x)
- x /= 10, d++;
- for (int j = 0; j < 9 - d; j++)
- cout << 0;
- return cout << i, 0;
- }
- }
- cout << 2, 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement