1.
简答题
分糖果

查看答案与解析
答案:<pre class="brush:cpp;toolbar:false">//参考代码1
#include <iostream>
using namespace std;
int n, l, r;
int main() {
cin >> n >> l >> r;
if (l / n == r / n) {
cout << r % n;
} else {
cout << n - 1;
}
return 0;
}</pre><pre class="brush:cpp;toolbar:false">//参考代码2
#include <iostream>
using namespace std;
int main() {
long long n, L, R;
cin >> n >> L >> R;
long long target = n - 1;
// 计算t的最小值(向上取整)
long long low = (L - target + n - 1) / n;
// 计算t的最大值(向下取整)
long long high = (R - target) / n;
if (low <= high) {
cout << target << endl;
} else {
cout << R % n << endl;
}
return 0;
}</pre><p></p>


