day-12
牛客多校三
https://ac.nowcoder.com/acm/contest/11254/F
dfs 模拟4个[1,13]内的整数加减乘除 能不能在有浮点数出现的情况下 达到m
(+ - * /) 在考虑运算先顺序的情况下 + *直接计算 - /需要分谁被减
判断一个数是不是浮点数 只需要他向上/下取整和原来的数相差是不是 <= esp
https://ac.nowcoder.com/acm/contest/11254/E
打表过了一个题目 __int128真的好用 233
** lower_是在有序数组中插入一个数同时保证数组单调性的最小的位置 **
** upper_是在有序数组中插入一个数同时保证数组单调性的最大的位置 **
lower_bound(a, a + n, 10, greater()) 这样子用在递减
const int maxn = 1e3 + 7;
ll n, t, m;
__int128 cal(__int128 now, __int128 base, __int128 bef) {
__int128 y = now * base - bef;
return y;
}
void solve() {
n = 1e18;
__int128 mx = 1e18;
vector<ll> vec;
for (__int128 x = 1; x * x * x <= mx; x++)
vec.push_back(x * x * x);
for (__int128 base = 2; base * base * base <= mx; base++) {
__int128 now = base * base * base, bef = base;
while (now <= mx) {
__int128 nx = cal(now, base * base, bef);
if (nx <= n)
vec.push_back(nx);
bef = now, now = nx;
}
}
sort(vec.begin(), vec.end());
// cout << vec.size() << endl;
cin >> t;
while (t--) {
cin >> n;
// int ans = lower_bound(vec.begin(), vec.end(), n) - vec.begin(); //错误写法...
cout << upper_bound(vec.begin(), vec.end(), n) - vec.begin() << endl;
}
}
ps:买了固态机子都拆完了 发现没排线nmd
我看见 你

浙公网安备 33010602011771号