2024.12.11 周三
1.2025.2.19——15002.11.23 周六3.11.24 周日4.11.25 周一日常5.2024.11.26 周二日常6.2024.11.27 周三7.2024.11.28周四8.2024.11.29 周五9.2024.11.30 周六10.2024.12.1 周日11.2024.12.2 周一12.2024.12.3 周二13.2024.12.4 周三14.2024.12.5 周四15.2024.12.7 周六16.2024.12.8 周日17.2024.12.9 周一18.2024.12.10 周二
19.2024.12.11 周三
20.2024.12.12 周四21.2024.12.13 周五22.2024.12.14 周六23.2024.12.16 周一24.2024.12.17 周二25.2024.12.18 周三26.2024.12.19 周四27.2024.12.20 周五28.2024.12.21 周六29.2024.12.22 周日30.2024.12.23 周一31.2024.12.24 周四32.2024.12.25 周三33.2024.12.26 周四34.2024.12.27 周五35.2024.12.28 周六36.2024.12.29 周日37.2024.12.30 周一38.2025.1.5——120039.2025.1.12——120040.2025.1.14——120041.2025.1.15——120042.2025.1.16——120043.2025.1.17——120044.2025.1.18——130045.2025.1.19——130046.2025.1.20——130047.2025.1.21——130048.2025.1.22——130049.2025.1.24——140050.2025.1.26——140051.2025.2.8——140052.2025.2.9——140053.2025.2.10——140054.2025.2.14——140055.2025.2.15——140056.2025.2.17——14002024.12.11 周三
Q1. 1100
给定一长度为 的数组,你需要执行 次操作:每次选择一连续子数组(可为空),将和作为一元素放到到数组的任意位置。问最后数组和的最大值。
Q2. 1100
给你一长度为 的数组 , ~ 各出现2次。让你找出两个大小为 集合 , ,其中 属于 1至 n, 属于 n+1至 2n。满足 异或和等于 异或和。
Q3. 1000
Rudolf has an array
In one operation, he can choose an index
Rudolf can apply this operation any number of times. Any index
Can he make all the elements of the array equal to zero using this operation?
Q4. 1100
给你一长度为 的数组, 为0, :1~n,找到大于 且为 i倍数的数,更新 。
------------------------独自思考分割线------------------------
A1. 2点
1.第一次操作必然是选择最大连续子数组,然后将其放到最大连续子数组内。
2.以后的操作就可以看作最大和一变二,二变四的过程。
A2. 2点
1.发现 1至 n这一侧单独出现的数字与右侧相同。
2.同时出现 次的数异或和为0。可以先使用出现 次的数构造,不够再使用单次出现的数构造。
A3. 1点
1.遍历贪心去减,不够减/最后没减为0则NO
A4. 2点
1.快速找到大于 的 i的倍数,直接枚举显然不可行。二分当然可以。
2.数学当然ok, i>x,=> >= / i,==>k= / i+1,取整的时候注意一下,答案就是 i。
------------------------代码分割线------------------------
A1.
#include <bits/stdc++.h>
#define int long long //
#define endl '\n' // 交互/调试 关
using namespace std;
#define bug(BUG) cout << "bug:# " << (BUG) << endl
#define bug2(BUG1, BUG2) cout << "bug:# " << (BUG1) << " " << (BUG2) << endl
#define bug3(BUG1, BUG2, BUG3) cout << "bug:# " << (BUG1) << ' ' << (BUG2) << ' ' << (BUG3) << endl
void _();
signed main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << fixed << setprecision(6);
int T = 1;
cin >> T;
while (T--)
_();
return 0;
}
const int mod = 1e9 + 7;
int qm(int a, int b)
{
int res = 1;
while (b)
{
if (b & 1)
res = res * a % mod; // 不要取模时记得取消
a = a * a % mod;
b >>= 1;
}
return res;
}
int inv(int n)
{
return qm(n, mod - 2);
}
void _()
{
int n, k;
cin >> n >> k;
int pre = 0, min_pre = 0, max_rangesum = 0;
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
pre += x;
max_rangesum = max(max_rangesum, pre - min_pre);
min_pre = min(min_pre, pre);
}
int res = (max_rangesum % mod * qm(2, k)) % mod;
res = (res + pre % mod - max_rangesum % mod + (int)(1e7) * mod) % mod;
cout << res << endl;
}
A2.
#include <bits/stdc++.h>
#define int long long //
#define endl '\n' // 交互/调试 关
using namespace std;
#define bug(BUG) cout << "bug:# " << (BUG) << endl
#define bug2(BUG1, BUG2) cout << "bug:# " << (BUG1) << " " << (BUG2) << endl
#define bug3(BUG1, BUG2, BUG3) cout << "bug:# " << (BUG1) << ' ' << (BUG2) << ' ' << (BUG3) << endl
void _();
signed main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << fixed << setprecision(6);
int T = 1;
cin >> T;
while (T--)
_();
return 0;
}
void _()
{
int n, k;
cin >> n >> k;
vector<int> l(n + 1);
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
l[x]++;
}
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
}
set<int> db_l, db_r, sgal;
for (int i = 1; i <= n; i++)
if (!l[i])
db_r.insert(i);
else if (l[i] == 1)
sgal.insert(i);
else
db_l.insert(i);
vector<int> res_l, res_r;
auto get = [&](vector<int> &res, set<int> &l)
{
for (auto x : l)
if (res.size() < k << 1)
res.push_back(x), res.push_back(x);
for (auto x : sgal)
if (res.size() < k << 1)
res.push_back(x);
};
get(res_l, db_l);
get(res_r, db_r);
for (auto v : res_l)
cout << v << ' ';
cout << endl;
for (auto v : res_r)
cout << v << ' ';
cout << endl;
}
A3.
#include <bits/stdc++.h>
#define int long long //
// #define endl '\n' // 交互/调试 关
using namespace std;
#define bug(BUG) cout << "bug:# " << (BUG) << endl
#define bug2(BUG1, BUG2) cout << "bug:# " << (BUG1) << " " << (BUG2) << endl
#define bug3(BUG1, BUG2, BUG3) cout << "bug:# " << (BUG1) << ' ' << (BUG2) << ' ' << (BUG3) << endl
void _();
signed main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << fixed << setprecision(6);
int T = 1;
cin >> T;
while (T--)
_();
return 0;
}
void _()
{
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
int f = 1;
for (int i = 1; i + 2 <= n; i++)
{
if (a[i + 1] < a[i] << 1 || a[i + 2] < a[i])
f = 0;
a[i + 1] -= a[i] << 1;
a[i + 2] -= a[i];
}
if (a[n - 1] || a[n])
f = 0;
cout << (f ? "YES" : "NO") << endl;
}
A4.
#include <bits/stdc++.h>
#define int long long //
#define endl '\n' // 交互/调试 关
using namespace std;
#define bug(BUG) cout << "bug:# " << (BUG) << endl
#define bug2(BUG1, BUG2) cout << "bug:# " << (BUG1) << " " << (BUG2) << endl
#define bug3(BUG1, BUG2, BUG3) cout << "bug:# " << (BUG1) << ' ' << (BUG2) << ' ' << (BUG3) << endl
void _();
signed main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cout << fixed << setprecision(6);
int T = 1;
cin >> T;
while (T--)
_();
return 0;
}
void _()
{
int n;
cin >> n;
int x;
cin >> x;
int res = x;
for (int i = 2; i <= n; i++)
{
cin >> x;
int k = res / x + 1;
res = x * k;
}
cout << res << endl;
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!