分糖果
CSP-J 2021 T1
题目链接:https://www.luogu.com.cn/problem/P7909?contestId=54994
#include#include #include #include #include #include<string> #include #include #include #include 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; }