AC了,但是觉得CSP的数据会不会更毒瘤一点?
查看原帖
AC了,但是觉得CSP的数据会不会更毒瘤一点?
367946
九龙云楼主2021/10/23 19:56

RT

#include<iostream>
#include<cstdio>

using namespace std;
long long l,r,n,i,ans,a;
long long maxn(long long a,long long b)
{
	if(a>b) return a;
	else if(a<b) return b;
	else return a;
} 
int main()
{
	cin>>n>>l>>r;
	a=l/n;l=l-a*n;r=r-a*n;
	if(r>n) cout<<n-1;
	else
	{
		for(i=l;i<=r;i++)
		{
			ans=maxn(ans,i%n);
		}
		cout<<ans;
	}
	return 0;
}

2021/10/23 19:56
加载中...