0.06s,最憋屈的TLE!
查看原帖
0.06s,最憋屈的TLE!
1074084
asd890123楼主2024/7/24 11:50

虽然不是正确解法,但是就超时那么点,有没有办法卡过去呢?求帮助,code:

#include <iostream>

int main(){

    #ifndef ONLINE_JUDGE
        freopen("P7909.in","r",stdin);
    #endif

    std::cin.tie(0)->sync_with_stdio(0);

    int n,l,r,ans = 0;

    std::cin >> n >> l >> r;
    for (int k = l;k <= r;k++) ans = std::max(ans,k % n);
    std::cout << ans << '\n';

    return 0;
}

ps:洛谷超时0.2s才会停止记时

2024/7/24 11:50
加载中...