优先队列(堆)
SSL_MYD
这个作者很懒,什么都没留下…
展开
-
【SSL】1411最小函数值
【SSL】1411 最小函数值 Time Limit:1000MS Memory Limit:65536K Total Submit:136 Accepted:61 Description 问题描述:有n个函数,分别为F1,F2,…,Fn。定义Fi(x)=Aix^2+Bix+Ci (x∈N*)。给定这些Ai、Bi和Ci,请求出所有函数的所有函数值中最小的m个(如有重复的要输出多个)。 Input 输入数据:第一行输入两个正整数n和m。以下n行每行三个正整数,其中第i行的三个数分别位Ai、Bi和Ci。Ai&原创 2021-03-20 10:51:30 · 75 阅读 · 0 评论 -
标程_哈夫曼树(堆优化)
标程_哈夫曼树(堆优化) #include<iostream> #include<cstdio> #include<queue> using namespace std; char ans[2010]=""; struct tree{int s,l,r;}a[2010];//s权值,l左子树地址,r右子树地址 struct jgt{int s;}; bool operator < (const jgt &t1 ,const jgt &t2){retu原创 2021-03-26 20:46:27 · 293 阅读 · 0 评论 -
【SSL】1220促销
【SSL】1220 促销 Time Limit:2000MS Memory Limit:65536K Total Submit:161 Accepted:36 Description Bytelandish连锁超市委托你编写一个程序来模拟一项即将施行的促销活动,该活动的规则如下: ●想要参与的顾客,只需把他的个人资料写在帐单上,并把帐单放入投票箱; ●每天活动结束时,数额最大、最小的两张帐单被取出,付款数额最大的顾客将获得一笔奖金,价值为取出的两张帐单的数额之差; ●为了不重复计算,取出的两张帐单不再放回原创 2021-03-20 12:04:23 · 75 阅读 · 0 评论 -
【SSL】1684USACO 3.1 Humble Numbers丑数
【SSL】1684 USACO 3.1 Humble Numbers丑数 (搜索) Time Limit:12000MS Memory Limit:65536K Total Submit:189 Accepted:48 Case Time Limit:1000MS Description 对于一给定的素数集合 S = {p1, p2, …, pK}, 来考虑那些质因数全部属于S 的数的集合。这个集合包括,p1, p1p2, p1p1, 和 p1p2p3 (还有其它)。这是个对于一个输入的S的丑数集合。原创 2021-03-20 11:34:18 · 76 阅读 · 2 评论 -
【POJ】3253围栏维修
【POJ】3253围栏维修 原题 Fence Repair Time Limit: 2000MS Memory Limit: 65536K Description Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having som原创 2021-03-20 09:42:49 · 579 阅读 · 0 评论 -
【SSL】1040 2004年分区联赛提高组之二 合并果子
【SSL】1040 2004年分区联赛提高组之二 合并果子 Time Limit:20000MS Memory Limit:65536K Total Submit:622 Accepted:287 Case Time Limit:5000MS Description 在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。 每一次合并,多多可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和。可以看出,所有的果子经过n-1次合并之后,就只剩下原创 2021-03-20 08:46:15 · 90 阅读 · 0 评论 -
标程_堆
标程_堆 大根堆 #include<iostream> #include<cstdio> using namespace std; const int maxlenth=0; class heapmx { private: int h[maxlenth],len; void up(int x);//上移操作,把h[x]上移的合适位置 void down(int x);//下移操作,把h[x]下移的合适位置 public: void swap(int &t1原创 2021-03-20 08:39:50 · 75 阅读 · 0 评论 -
【SSL】1271排序I
【SSL】1271 排序I Time Limit:1000MS Memory Limit:65536K Total Submit:798 Accepted:334 Description 输入n(<=100000),由小到大输出 Input n n个数 Output 由小到大输出 Sample Input 5 3 2 1 4 5 Sample Output 1 2 3 4 5原创 2021-03-19 22:19:33 · 67 阅读 · 0 评论