1 solutions

  • 0
    @ 2024-12-5 18:13:41

    C++ :

    #include "bits/stdc++.h"
    using namespace std;
    
    int main()
    {
    	int n,l,r;
    	scanf("%d%d%d",&n,&l,&r);
    	if(r-l>=n) printf("%d",n-1);
    	else
    	{
    		int t=l%n;
    		int f=r%n;
    		if(f<t) printf("%d",n-1);
    		else printf("%d",f);
    	}
    	return 0;
    }
    
    • 1

    Information

    ID
    9126
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By