瞧一瞧看一看简单易懂童叟无欺-纪念品分组 摘要:参考代码: #include<bits/stdc++.h> using namespace std; int w,n,ans=0; int a[30005]; int main(){ …… 题解列表 2022年01月10日 0 点赞 2 评论 131 浏览 评分:7.3
纪念品分组-题解(C++代码)简单易懂 摘要:解题思路:1.排序2.还记得快排吗!用fir和end标记数组首尾,核心代码如下 if(value[fir]+value[end]<=W&&(fir!=end)){ tol+…… 题解列表 2020年09月15日 0 点赞 0 评论 904 浏览 评分:7.3
纪念品分组-题解(C++代码) 摘要:```cpp #include//使用双指针扫描法。 #include #include using namespace std; const int M=30000; int main(…… 题解列表 2020年04月23日 0 点赞 0 评论 407 浏览 评分:0.0
纪念品分组 (C++代码)贪心的方法 摘要:解题思路: //贪心的思想: 把最大的和最小的相加 如果大于了 那么最大的那个 只能单独一个组 // 然后最小的再跟第二大的 如果不大于 那么就组成一个组 然后赋值为0 然后第二小的继续注意事项…… 题解列表 2019年04月07日 0 点赞 0 评论 1037 浏览 评分:9.0
纪念品分组 (C++代码) 摘要:解题思路:注意事项:参考代码:#include<iostream> #include<algorithm>using namespace std;int main() { int w,n; cin>>…… 题解列表 2019年03月23日 0 点赞 0 评论 352 浏览 评分:0.0
纪念品分组 (C++代码) 摘要:解题思路:此题为比较经典的贪心题,因为题目要求是每组最多只能包括两件纪念品,所以只需对读入的数据从小到大排序,之后直接模拟即可。注意事项:参考代码:#include<bits/stdc++.h> u…… 题解列表 2019年02月26日 0 点赞 0 评论 1295 浏览 评分:7.3
纪念品分组 (C++代码) 摘要:参考代码:#include <iostream>using namespace std;void quick_sort(int a[],int begin,int end)//数组排序函数 { if(…… 题解列表 2019年02月24日 0 点赞 0 评论 516 浏览 评分:0.0
纪念品分组 (C++代码) 摘要:排序 + 贪心#include<iostream> #include<algorithm> #define max_num 30001 using namespace std; int m…… 题解列表 2019年01月26日 0 点赞 0 评论 624 浏览 评分:7.3
纪念品分组 (C++代码) 摘要:解题思路:大水题没什么好说的注意事项:不懂请留言!参考代码:#include <bits/stdc++.h> using namespace std; int n,k; int const ma…… 题解列表 2018年10月02日 1 点赞 3 评论 1601 浏览 评分:8.9