Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- for(int i = 1; i <= 20; ++i){
- int sum, tr;
- scanf("%d", &sum);
- scanf("%d", &tr);
- if(sum % 2 == 0){
- int x = (sum / 2) - tr;
- int r = tr - x;
- if(x >= 0 && r >= 0){
- cout << r + 1 << "\n";
- continue;
- }
- }
- cout << 0 << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement