数学方法:从每个箱子来考虑:m次选择以后,至少有一次被选中的概率为.因为这些箱子是相互独立的,所以被选中的箱子数的期望为 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 int ...
分类:
其他好文 时间:
2015-07-31 12:23:26
阅读次数:
112
业务有这样的需求,类似瀑布流。内容两列不等高展示。只需要继承panel,重写MeasureOverride和ArrangeOverride方法就行了。很简单,内容都在代码里。using System;using System.Collections.Generic;using System.Lin....
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Analyse: Using binary search to divide the sorted arr...
分类:
其他好文 时间:
2015-07-31 12:19:02
阅读次数:
102
1 #include 2 #include 3 4 using namespace std; 5 6 struct Node 7 { 8 int l,r; 9 int v; 10 int lz; 11 }bn[400000]; 12 13 voi...
分类:
其他好文 时间:
2015-07-31 12:13:52
阅读次数:
124
我们先新建一个WPF项目MVVMLightDemo,添加GalaSoft.MvvmLight.dll(没有可以自己下载) 然后在项目中添加三个文件夹,如图: 先添加我们的Model,在Model下新建一个类Student using GalaSoft.MvvmLight;usi...
分类:
其他好文 时间:
2015-07-31 12:05:51
阅读次数:
87
题目描述:
给定一张图,问如何顺序排列结点,能使排列中任意有边相连的两个节点之间的距离最大的值最小,如果有两个排列最大值相等,请输出字典序小的
分析:排列树+剪枝
在构造排列树的同时检查当前已经构成的序列中最大值是否小于最优质,如果大于剪掉即可
#include
#include
#include
using namespace std;
int g[27][27];...
分类:
其他好文 时间:
2015-07-31 10:47:20
阅读次数:
89
格式控制,没看到,开始wrong了
#include
#include
using namespace std;
int n,L;
int cnt=0;
int S[90];
int dfs(int cur){
if(cnt++ == n){
int haha=0;
for(int i=0;i<cur;i++) { if(i%4==0&&i!=0){ ...
分类:
其他好文 时间:
2015-07-31 10:42:39
阅读次数:
161
LR1文法全智能分析
// by hfut yzk#include "stdafx.h"
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#pragma region vars
struct xiangmu //一个项目
{
...
分类:
其他好文 时间:
2015-07-31 10:40:07
阅读次数:
170
#include
using namespace std;struct Node
{
int data;
Node *next;
Node(int d = int()) :data(d), next(NULL){}
};class Clist
{
public:
Clist(int a[], int n) :first(NULL)
{...
分类:
编程语言 时间:
2015-07-31 10:35:13
阅读次数:
128
1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 struct Node 8 { 9 int l,r;10 int num;11 }bn[16000000];12 13 void build(int...
分类:
其他好文 时间:
2015-07-31 10:31:15
阅读次数:
135