2024.12.21 周六
2024.12.21 周六
Q1. 1000
Lottery "Three Sevens" was held for
It is known that in each of the
Unfortunately, the information about the lottery winners has been lost. You need to find any possible list of lottery winners on days from
Q2. 1000
Kristina has a string
For example, if she has the string
= "a" and = "A" = "a" and = "A" = "B" and = "b" = "C" and = "c"
Kristina wants to get more burles for her string, so she is going to perform no more than
- either select the lowercase character
( ) and make it uppercase. - or select uppercase character
( ) and make it lowercase.
For example, when
Find maximum number of burles Kristina can get for her string.
Q3. 1000
You are given a two-dimensional plane, and you need to place
You can place a chip only at a point with integer coordinates. The cost of placing a chip at the point
The cost of placing
You need to place
------------------------独自思考分割线------------------------
-
Q1 Q3有些意思。1000分的题先到这,位运算,构造,数论,三者最难。
A1.
- 发现制约关系:当前答案的数后面的数组都不能出现。从后向前扫,未标记的数就可以作为答案。
- 这是必要性,需要证明一下充分性。
A2.
- 本质就是大小写匹配的次数,剩下的自己匹配自己(需要代价)。
- 前一天扫描贪心匹配wa了,现在复习也没时间去找bug。
先这样了
A3.
- 被卡住了
还有些疑问,去学vue写报告了,先这样
------------------------代码分割线------------------------
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;
}
void _()
{
int m;
cin >> m;
vector<vector<int>> a(m);
vector<int> vis(50010);
for (auto &v : a)
{
int n;
cin >> n;
while (n--)
{
int x;
cin >> x;
v.push_back(x);
}
}
vector<int> res;
for (int i = m - 1; i >= 0; i--)
{
auto v = a[i];
int f = 0;
for (auto t : v)
{
if (!vis[t] && !f)
{
f = 1;
res.push_back(t);
}
vis[t] = 1;
}
}
if (res.size() - m)
res.assign(1, -1);
reverse(res.begin(), res.end());
for (auto v : res)
cout << v << " ";
cout << 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 m;
cin >> m;
vector<vector<int>> a(m);
vector<int> vis(50010);
for (auto &v : a)
{
int n;
cin >> n;
while (n--)
{
int x;
cin >> x;
v.push_back(x);
}
}
vector<int> res;
for (int i = m - 1; i >= 0; i--)
{
auto v = a[i];
int f = 0;
for (auto t : v)
{
if (!vis[t] && !f)
{
f = 1;
res.push_back(t);
}
vis[t] = 1;
}
}
if (res.size() - m)
res.assign(1, -1);
reverse(res.begin(), res.end());
for (auto v : res)
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;
int res = ceil(sqrtl(n)) - 1;
cout << res << endl;
}
// void _()
// {
// int n;
// cin >> n;
// int qrt_n = sqrt(n);
// int k = qrt_n / 2 + (qrt_n * qrt_n != n);
// int res = k - 1 << 1 | 1;
// if ((k - 1) * (k - 1) << 2 == n - 1)
// res--;
// if (n == 1)
// res = 0;
// // bug(k);
// cout << res << endl;
// }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!