活动安排—Python版(贪心策略) 摘要:解题思路:不相交区间问题注意事项:参考代码:n= int(input())a = []for i in range(n):s,f = map(int,i…… 题解列表 2025年04月08日 0 点赞 0 评论 49 浏览 评分:0.0
活动安排-排序 摘要:解题思路:题意就是求出一个时间段最多相容的数量,意味着我们只需要排序出所有时间段的顺序后按照a[i+1].first>=a[i].second就能求得最优解,按照结束的时间段排序即可测试数据:…… 题解列表 2025年04月07日 0 点赞 0 评论 92 浏览 评分:0.0
信息学奥赛一本通T1422-活动安排 摘要:解题思路:注意事项:参考代码:#include"bits/stdc++.h" using namespace std; // 定义结构体aaa,包含两个整数成员s和f struct aaa{ …… 题解列表 2024年11月17日 1 点赞 0 评论 296 浏览 评分:0.0
包会,不会你来锤我 摘要:#### 贪心策略:优先选择先结束的活动,保证每个选择子结构的最佳结果 ```cpp #include #include using namespace std; //创建结构体,结构体…… 题解列表 2024年10月31日 1 点赞 3 评论 386 浏览 评分:10.0
信息学奥赛一本通T1422-活动安排 摘要:解题思路:注意事项:参考代码:#include<iostream>#include<algorithm>using namespace std;struct Node{ int start,en…… 题解列表 2024年03月19日 1 点赞 0 评论 416 浏览 评分:9.9
编写题解 2335: 信息学奥赛一本通T1422-活动安排 摘要:解题思路:注意事项:参考代码:n=int(input())t=[]a=1#互相兼容的活动数量for i in range(n): t.append(input().split())for i i…… 题解列表 2024年03月16日 0 点赞 0 评论 295 浏览 评分:0.0
信息学奥赛一本通T1422-活动安排(贪心算法) 摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;struct Node{ int x, y;}I[1005];int cmp(…… 题解列表 2022年07月31日 0 点赞 0 评论 459 浏览 评分:2.0
信息学奥赛一本通T1422-活动安排 摘要:#include<bits/stdc++.h>using namespace std;const int N=1010;int n;pair<int,int> p[N];int main(){ …… 题解列表 2022年04月05日 0 点赞 0 评论 568 浏览 评分:9.9
区间贪心 不相交的区间最大个数 摘要:解题思路: 贪心区间 1.对区间左端点进行从大到小排序,左端点相同则按右端点从小到大排序; 2.记录排列好的第一个被选中区间的…… 题解列表 2022年04月05日 0 点赞 0 评论 477 浏览 评分:6.0
C++区间贪心,做个笔记期末自己复习用,说标题太短不让我发 摘要:解题思路:书上那个4.4.2已经很细了,期末时要是忘记了就去翻122页,多覆盖效率高注意事项:题中为开区间参考代码:#include<bits/stdc++.h>using namespace std…… 题解列表 2022年04月05日 0 点赞 0 评论 410 浏览 评分:0.0