CSP-J 2021 T1
题目链接:https://www.luogu.com.cn/problem/P7909?contestId=54994
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<string> #include<cstdlib> #include<queue> #include<stack> #include<vector> using namespace std; int n, L, R, ans, LR; int main() { cin>>n>>L>>R; LR=R-L; if(LR >= n ) ans=n-1; else{ if(L%n + LR >= n) ans=n-1; else ans=L%n + LR; } cout<<ans; return 0; }