Naxocist

Fortress

May 3rd, 2022
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. using ll = long long;
  5. using pi = pair<int, int>;
  6. using tiii = tuple<int, int, int>;
  7.  
  8.  
  9. int main() {
  10.     // freopen("input.in", "r", stdin);
  11.  
  12.     for(int i=0; i<20; ++i){
  13.         ll m, n;
  14.         scanf("%lld%lld", &m, &n);
  15.  
  16.         m /= 2;
  17.         ll c = m - n;
  18.         if(c < 0 || c > n){
  19.             printf("0\n");
  20.             continue;
  21.         }
  22.        
  23.         printf("%lld\n", m - (2*c) + 1);
  24.  
  25.     }
  26.    
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment