1 solutions

  • 0
    @ 2025-12-6 20:28:25
    #include<bits/stdc++.h>
    using namespace std;
    int a[3],st;
    int main()
    {
    	freopen("herding.in","r",stdin);
    	freopen("herding.out","w",stdout);
    	cin>>a[0]>>a[1]>>a[2];
    	sort(a,a+3);
    	if(a[2]-a[1]==1&&a[1]-a[0]==1)
    	{
    		cout<<0;
    	}
    	else if(a[2]-a[1]==2||a[1]-a[0]==2)
    	{
    		cout<<1;
    	}
    	else
    	{
    		cout<<2;
    	}
    	cout<<"\n"<<max(a[2]-a[1],a[1]-a[0])-1; 
        return 0;
    }
    

    baidu

    • 1

    Information

    ID
    774
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    9
    Accepted
    3
    Uploaded By