摘要: 原题链接 题解 每次从所有果子堆中选重量最小的两堆并累加,观察到只需要找出 最小 因此考虑用堆,而当你对于堆的理解足够深之后,可以用c++ 的 priority_queue 代码 #include<bits/stdc++.h> using namespace std; int pile[10005] 阅读全文
posted @ 2023-11-26 16:58 纯粹的 阅读(62) 评论(0) 推荐(1)
摘要: 1. 利用map实现速查,优点是代码简洁,缺点是速度慢,内存大 #include<bits/stdc++.h> using namespace std; int a[200005]={0}; int main() { int n,c; scanf("%d%d",&n,&c); map<int,int 阅读全文
posted @ 2023-11-26 16:28 纯粹的 阅读(34) 评论(0) 推荐(0)