Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <algorithm>
- using namespace std;
- long long ostatok(long long a, long long b)
- {
- while (a > 0)
- {
- a -= b;
- if (a < b)
- break;
- }
- a = abs(a);
- return a;
- }
- long long delenie (long long a, long long b)
- {
- long long znach = 0;
- while (a > 0)
- {
- znach++;
- a -= b;
- if (a < b)
- break;
- }
- return znach;
- }
- int main()
- {
- long long a, b;
- cin >> a >> b;
- if (a == b)
- cout << 1 << " " << 0;
- else if (a < b)
- cout << 0 << " " << ostatok(a, b);
- else cout << delenie(a, b) << " " << ostatok(a, b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement