题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=1050题意:给出一个带权图。求一条s到t的路径使得这条路径上最大最小边的比值最小?思路:将边排序。枚举最小边,然后将边一个一个插到并查集里,s和t联通时计算更新答案。struct node{...
分类:
其他好文 时间:
2014-06-23 06:13:19
阅读次数:
221
typedef可以用于定义函数指针类型:【语法】typedef (*)(参数表)typedef (::*)(参数表)【用途】1、可以用来定义该函数类型的函数指针,就不用每次使用函数指针都要写一次函数原型了;2、有了类型名,就可以使用在容器里面,譬如map,用于实现灵活的函数调用。【示例】例1:t.....
分类:
其他好文 时间:
2014-06-23 00:41:13
阅读次数:
198
一、platform总线、设备和驱动 platform是一种虚拟总线,对应的设备称为platform_device,对应的驱动称为platform_driver。platform_device定义在中: 1 struct platform_device { 2 const char ...
分类:
系统相关 时间:
2014-06-23 00:17:01
阅读次数:
385
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *...
分类:
其他好文 时间:
2014-06-22 23:59:58
阅读次数:
244
使用函数getifaddrs来枚举网卡IP,其中使用到的结构体如下所示:
struct ifaddrs
{
struct ifaddrs *ifa_next; /* Next item in list */
char *ifa_name; /* Name of interface */
unsigned int ifa_...
分类:
系统相关 时间:
2014-06-22 22:53:27
阅读次数:
394
链表数据结构的定义很简洁:
struct list_head {
struct list_head *next, *prev;
};
list_head结构包含两个指向list_head结构的指针prev和next,该内核链表具备双链表功能,通常它都组织成双循环链表,这里的list_head没有数据域。在Linux内核链表中,不是在链表结构中包含数据,而是在数据结构中包含链表节点。...
分类:
系统相关 时间:
2014-06-22 21:17:54
阅读次数:
312
1.使用print命令查看变量值
使用print命令(简写为p)可以查看变量值。
使用如下的程序1进行测试。
#include
struct node{
int index;
struct node* next;
};
int main(void) {
struct node head;
head.index = 1;...
分类:
其他好文 时间:
2014-06-22 20:53:08
阅读次数:
301
与Object-c一样,swift使用自动引用计数来跟踪并管理应用使用的内存。当实例不再被使用时,及retainCount=0时,会自动释放是理所占用的内存空间。
注:引用计数仅适用于类的实例,因为struct和enumeration属于值类型,也就不牵涉引用,所以其存储和管理方式并不是引用计数。
当一个实例被初始化时,系统会自动分配一定的内存空间,用于管理属性和方法。当实例对象不再被使用时,...
分类:
其他好文 时间:
2014-06-22 18:34:42
阅读次数:
206
f[i]=f[i-1]*p+f[i-2]*(1-p);
正好可以用矩阵加速。。。。
#include
#include
#include
#include
#include
using namespace std;
struct matr
{
double mat[3][3];
friend matr operator *(const matr a,const matr b)
...
分类:
其他好文 时间:
2014-06-22 18:23:06
阅读次数:
173
并查集。 1 #include 2 #include 3 #include 4 5 #define MAXN 10005 6 #define INF 0xffffff 7 8 typedef struct { 9 int c, s, e;10 } edge_st;11 12 ed...
分类:
其他好文 时间:
2014-06-21 17:29:36
阅读次数:
178