4 solutions

  • -1
    @ 2025-7-22 11:14:44
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int x,y,z,s=0;
    	cin>>x>>y>>z;
    	if(x>0)
    	{
    		if(y>x || y<0) s=x;
    		else
    		{
    			if(z<0) s=2*abs(z)+x;
    			else if(z<y) s=x;
    			else s=-1;
    		}
    	}
    	else
    	{
    		if(y>0 || y<x) s=abs(x);
    		else
    		{
    			if(z>0) s=2*z+abs(x);
    			else if(z>y) s=abs(x);
    			else s=-1;
    		}
    	}
    	cout<<s;
    	return 0;
    }
    

    Information

    ID
    2365
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    (None)
    # Submissions
    112
    Accepted
    34
    Uploaded By