P7909 100pts Unaccepted
  • 板块学术版
  • 楼主LAICZ
  • 当前回复2
  • 已保存回复2
  • 发布时间2022/7/17 15:38
  • 上次更新2023/10/27 19:52:59
查看原帖
P7909 100pts Unaccepted
606173
LAICZ楼主2022/7/17 15:38

题目


#include <bits/stdc++.h>
#define u unsigned
#define rr register
#define ll long long 

using namespace std;

inline long long read(){
    char ch = getchar();
    int x = 0;bool s = 1;
    while(!isdigit(ch)){if(ch == '-')s = 0;ch = getchar();}
    while(isdigit(ch)){x = x * 10 + ch - '0';ch = getchar();}
    return s?x:-x;
}//quick read

void write(long long num){
    if(num > 9){
        write(num / 10);
    }
    putchar(num % 10 + '0');
    return;
}//quick write

int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);

    int n,l,r,ans;
    cin>>n>>l>>r;
    //l<=nx<=r
    //x++ nx >= l
    //x = ceil(l / n)
    if(ceil(l * 1.0 / n) * n >= l && ceil(l * 1.0 / n) * n <= r) ans = n - 1;//#1
    else ans = r % n;//#2,#3

    cout<<ans;
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}
2022/7/17 15:38
加载中...