1 条题解

  • 0
    @ 2026-1-11 23:22:43

    #include <bits/stdc++.h>
    using std::cin;
    using std::cout;
    
    void work() {
    	int n, V, L, R, t, ans, fl, cost;
    	cin >> V >> L >> R >> t >> n, V /= n;
    	for (n = ans = 1; n > 0; ++ans, n *= 2) {
    		if (R - L <= (long long)n * t) {cout << ans - 1 << '\n'; return;}
    		if ((fl = R - t - V / ans) > 0) cost = (fl + t - 1) / t, n -= cost, R -= cost * t;
    	}
    	cout << "impossible\n";
    }
    
    int main() {
    	int T;
    	std::ios::sync_with_stdio(false), cin.tie(NULL);
    	for (cin >> T; T; --T) work();
    	return 0;
    }
    
    • 1

    信息

    ID
    5777
    时间
    1000ms
    内存
    1028MiB
    难度
    10
    标签
    递交数
    1
    已通过
    1
    上传者