Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- #include <algorithm>
- #include <set>
- #include <string>
- #define ll long long
- using namespace std;
- int main()
- {
- int n, a, b;
- cin >> n >> a >> b;
- int ans = 0;
- if (n > max(a, b))
- {
- int x = min(a, b);
- int y = n - x;
- while (x >= 0 && y <= b)
- {
- ++ans, --x, ++y;
- }
- }
- else
- {
- int x = 0;
- int y = n;
- while (x <= a && y >= 0)
- {
- ++ans, ++x, --y;
- }
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement