
分治
王猛旗
在读研究僧
展开
-
HDOJ3743<分治>
In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted i原创 2016-04-03 14:09:46 · 724 阅读 · 0 评论 -
HDU1425 <sort 快排>
给你n个整数,请按从大到小的顺序输出其中前m大的数。每组测试数据有两行,第一行有两个数n,m(0//sort也可以过//936Ms#include#include#includeusing namespace std;const int maxn=1000005;int ans[maxn];bool cmp(int a,int b){ return a>b;}原创 2016-04-16 12:39:00 · 588 阅读 · 0 评论 -
贪心<haonan>
题意:有一列数,每次在相邻的两个书里面选择一个大数留下,同时ans+大数。问题是,求ans的最小值。题解:如果a[i]>a[i-1],那么ans+=a[i];如果a[i]>=a[i+1],那么ans+=a[i]; 队长的博客#include<cstdio>//队长的代码typedef long long LL;LL a[1000005];int main(){ int n;原创 2016-06-13 15:11:55 · 304 阅读 · 0 评论