贪心策略:先按分数从大到小排序,分数一样,再按时间从小到大排序 分最高的越靠近期限完成,越好 话不多说直接看代码
题目链接
http://acm.hdu.edu.cn/showproblem.php?pid=1789
代码:
#include
#include
#include
using std::sort;
typedef struct{
int sco, time;
...
分类:
其他好文 时间:
2014-07-29 15:18:48
阅读次数:
170
在计算机科学中,二叉树是一种重要的非线性的数据结构。每个结点的度均小于等于2,通常子树称为左子树和右子树。而排序二叉树是二叉树中的一种,其满足:1. 如左子树不为空,那么左子树上的结点的值都小于其根上的值;2. 如右子树不为空,那么右子树上的结点的值都大于其根上的值; 3. 其子树也是一个排序二叉树。
下面用递归的方式来插入一个结点来满足上述的要求:
typedef struct Node
{...
分类:
其他好文 时间:
2014-07-29 15:02:28
阅读次数:
160
#include
#include
#include
#define MAXN 5000+5
#define MAXM 200+5
typedef struct Dic{
char str[MAXN];
struct Dic* next;
}Dic;
Dic *head;
char word[MAXM];
int cnt=0;
int get_word();
void conver...
分类:
其他好文 时间:
2014-07-29 14:55:28
阅读次数:
156
LDD和各种结构体的故事
struct scull_dev位置:scull/scull.h
struct scull_dev {
struct scull_qset *data; /* Pointer to first quantum set */
int quantum; /* the current quantum size */
i...
分类:
其他好文 时间:
2014-07-29 14:52:16
阅读次数:
269
//暴搜
# include
# include
# include
using namespace std;
struct node
{
int b;
int e;
int num;
};
struct node a[10010];
int cmp(node a1,node a2)
{
return a1.b<a2.b;
}
int main()
{...
分类:
其他好文 时间:
2014-07-29 14:48:08
阅读次数:
158
#include
#include
#include
struct file_operations;
struct inode;
struct module;
struct cdev {
struct kobject kobj;
struct module *owner;
const struct file_opera...
分类:
系统相关 时间:
2014-07-29 14:18:28
阅读次数:
280
一: socket编程中的几种地址 Socket编程会遇到三种地址, 都是定义的结构体(struct): Struct in_addr { Unsigned int s_addr; } 这是一个IPv4地址,在IPv4的报文中,源地址和目的地址用32bit表示。通常定义在netinet/in.h中....
分类:
其他好文 时间:
2014-07-29 14:13:38
阅读次数:
276
题目:输入一个整数和一棵二元树。从树的根结点开始往下访问一直到叶结点所经过的所有结点形成一条路径。打印出和与输入整数相等的所有路径。例如输入整数22和如下二元树 10 / \ 5 12 / \ 4 7则打印出两条路径:10, 12和10, 5, 7。二元树结点的数据结构定义为:struct Bin....
分类:
其他好文 时间:
2014-07-29 14:04:38
阅读次数:
304
题目链接:点击打开链接
求给定的3维坐标的凸包的表面积
三维凸包裸题。。
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define PR 1e-8
#define N 510
struct TPoint{
double x, y, z;
TPoint...
分类:
其他好文 时间:
2014-07-29 13:21:47
阅读次数:
205
一种动态内存管理Malloc/Free服务的链表实现 , 动态内存分配与回收服务,Malloc/Free的实现,最主要的核心内容是单向链表。其数据结构定义如下,一整段内存被SRAM或SDRAM,DRAM由系统的内存管理模块统一管理,这里主要是堆的管理:
typedef struct A_BLOCK_LINK
{
struct A_BLOCK_LINK *pxNextFre...
分类:
其他好文 时间:
2014-07-29 13:21:31
阅读次数:
433