两个二分 枚举位数 #include <bits/stdc++.h> #define MOD 1000000007 using namespace std; typedef long long ll; ll ten[]; ll check1(ll x) { ll ans = ; ll l, r; ; i <= ; i++) { l = ten[i], r = ten[i + ] - ; if (r < x) { ans += i * ( * x - l - r) * (r - l…
You are given an array a consisting of n integers, and additionally an integer m. You have to choose some sequence of indices \(b_1, b_2, ..., b_k (1 ≤ b_1 < b_2 < ... < b_k ≤ n)\) in such a way that the value of \(\sum^{k}_{i=1}a_{b_i}\) is maxi…