Codeforces 1023 B.Pair of Toys (Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Fi)
B. Pair of Toys
智障题目(嘤嘤嘤~)
代码:
1 //B
2 #include<iostream>
3 #include<cstdio>
4 #include<cstring>
5 #include<algorithm>
6 #include<bitset>
7 #include<cassert>
8 #include<cctype>
9 #include<cmath>
10 #include<cstdlib>
11 #include<ctime>
12 #include<deque>
13 #include<iomanip>
14 #include<list>
15 #include<map>
16 #include<queue>
17 #include<set>
18 #include<stack>
19 #include<vector>
20 using namespace std;
21 typedef long long ll;
22
23 const double PI=acos(-1.0);
24 const double eps=1e-6;
25 const ll mod=1e9+7;
26 const int inf=0x3f3f3f3f;
27 const int maxn=1e5+10;
28 const int maxm=100+10;
29 #define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
30
31 int main()
32 {
33 ll n,m;
34 scanf("%lld%lld",&n,&m);
35 if(2*n-1<m)
36 cout<<"0"<<endl;
37 else{
38 ll ans;
39 if(n>=m){
40 if(m%2==0)
41 ans=m/2-1;
42 else
43 ans=m/2;
44 }
45 else{
46 ans=n-m/2;
47 }
48 cout<<ans<<endl;
49 }
50 }