CF1562A 一个区间任意两个取模的最大值
The Miracle and the Sleeper - CodeForces 1562A - Virtual Judge (vjudge.net)
题意就是标题
#include<iostream> using namespace std; int main(){ int T; cin>>T; while(T--) { int l,r,res=-1; scanf("%d%d",&l,&r); if(l<=r/2) { int x=r/2; int x1=x; x1++; x1=r-x1; x--; res=max(x1,x); } else res=r-l; printf("%d\n",res); } return 0; } /* 两者取最大值(如果包含):除以2和n-除以2+1的最大值 不包含: 就相减就可以了 */
浙公网安备 33010602011771号