2024.11.29 周五
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.11.29 周五
-
Q1. 1200
给定黑白保龄球a,b个,设合法摆放为:金字塔形状,每层个数1,2,3...,且每层颜色相同。问最多可合法摆放层数的数量。 -
Q2. 1400
三种特定的木头长度18,21,25,一根长度为60的木头可以截成多段。分别需要n根长度为18,21,25的木头,问最少需要多少长度为60的木头。 -
Q3. 1600
给定一个数n和初始大小n*n空矩阵,构造n个点,使所有点对的曼哈顿距离的种类数最多。 -
A1. 18mins
(猜测)答案为最大的n满足n*(n+1)/2<=s。 -
A2. 14mins-16mins
发现长60的木头最多贡献2/3根木头,贪心3根:18,18,21 / 18,21,21。 -
A3. 35mins
观察样例发现0~2n-2都能被构造出(如果没有样例只能自己去想),即能被构造出答案的上界。
这就要求了除了第一个点,每个点都要有2个贡献。
考虑一种特殊的图样(如下图),利用1,2行及对角线即可构造出一种3,4,5,6...2n-3,2n-2.的距离。
x.....
x.....
..x...
...x..
....x.
.....x
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
const int mod = 998244353;
const int N = 10 + 5e5;
void _();
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while (t--)
_();
return 0;
}
// 给定黑白保龄球a,b个,设合法摆放为:金字塔形状,每层个数1,2,3...,且每层颜色相同。问最多可合法摆放层数的数量。
// 18mins
// (猜测)答案为最大的n满足n*(n+1)/2<=s。
void _()
{
int a, b;
cin >> a >> b;
int s = a + b;
int l = -1, r = 1e9;
while (r - l - 1)
{
int mid = l + r >> 1;
if (mid * (mid + 1) <= s << 1)
l = mid;
else
r = mid;
}
cout << l << 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);
int T = 1;
// cin >> T;
while (T--)
_();
return 0;
}
// 三种特定的木头长度18,21,25,一根长度为60的木头可以截成多段。分别需要n根长度为18,21,25的木头,问最少需要多少长度为60的木头。
// 14mins-16mins
// 发现长60的木头最多贡献2/3根木头,贪心3根:18,18,21 / 18,21,21。
void _()
{
int n;
cin >> n;
int res = n / 3 * 2;
if (n % 3)
{
res++;
if (n % 3 == 2)
n++;
}
res += n + 1 >> 1;
cout << res << 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);
int T = 1;
cin >> T;
while (T--)
_();
return 0;
}
// 1600分
// 给定一个数n和初始大小n*n空矩阵,构造n个点,使所有点对的曼哈顿距离的种类数最多。
// 35mins
// 观察样例发现0~2n-2都能被构造出(如果没有样例只能自己去想),即能被构造出答案的上界。
// 这就要求了除了第一个点,每个点都要有2个贡献。
// 考虑一种特殊的图样(如下图),利用1,2行及对角线即可构造出一种3,4,5,6...2n-3,2n-2.的距离。
// x.....
// x.....
// ..x...
// ...x..
// ....x.
// .....x
void _()
{
int n;
cin >> n;
auto print = [](int x, int y)
{
cout << x << ' ' << y << endl;
};
print(1, 1);
print(2, 1);
for (int i = 3; i <= n; i++)
print(i, i);
cout << endl;
}
合集:
日常训练
标签:
codeforces
, 算法竞赛
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!