POJ 3189 Steady Cow Assignment
题目链接
题意:一些牛,每个牛心目中都有一个牛棚排名,然后给定每个牛棚容量,要求分配这些牛给牛棚,使得所有牛对牛棚的排名差距尽量小
思路:这种题的标准解法都是二分一个差值,枚举下界确定上界,然后建图判断,这题就利用最大流进行判断,值得一提的是dinic的效率加了减枝还是是卡着时间过的,这题理论上用sap或者二分图多重匹...
分类:
其他好文 时间:
2014-11-07 23:31:18
阅读次数:
412
The following table lists the precedence and associativity of C++ operators. Operators are listed top to bottom, in descending precedence.
Precedence
Operator
Description
Associativity...
分类:
编程语言 时间:
2014-11-07 17:00:05
阅读次数:
180
C++伪函数:
所谓的伪函数,就是说它不是一个真正的函数,而是一个类或者说是一个结构体。
#include
void say_hello(){
std::cout << "hello world !" << std::endl;
}
class Hello{
public:
void operator () (){
std::c...
分类:
编程语言 时间:
2014-11-07 14:51:42
阅读次数:
177
if ?else形式 [nxuser@PSjamsBond-0-0-0?~]$?vi?testoperator.py
#!/bin/python
#operator?testing
number1=111
number2=222
if(number1>number2):
??print("num1>num2")
else:
??print("num2>num1"...
分类:
编程语言 时间:
2014-11-05 20:00:21
阅读次数:
266
assign / deassginforce /releasethe procedural continuous assignments(using keywords assign and force) are procedural statements that allow expressions...
分类:
其他好文 时间:
2014-11-04 19:19:18
阅读次数:
210
1 class LogFile 2 { 3 public: 4 static LogFile &instance(); 5 operator FILE *() const { return m_file; } 6 private: 7 LogFile(const char *filen...
分类:
编程语言 时间:
2014-11-04 19:06:12
阅读次数:
322
1、仿函数的概念仿函数(functor),就是使一个类的使用看上去象一个函数。其实现就是类中实现一个operator(),这个类就有了类似函数的行为,就是一个仿函数类了。在写代码时有时会发现有些功能的实现的代码,会不断的在不同的成员函数中用到,但是又不好将这些代码独立出来成为一个类的一个成员函数。但...
分类:
编程语言 时间:
2014-11-04 16:44:33
阅读次数:
155
优先队列:可以当做一个堆用,对进入此结构的类型,可以找队首的元素。开库:#include定义: priority_queue Q;type:int类型 priority Q; 默认Q.top为队列中最大的;当我们要在队列中放入其他类型时,我们要用struct 在其中定义 operator Q.to....
分类:
其他好文 时间:
2014-11-02 22:28:47
阅读次数:
148
HDU 2853 Assignment
题目链接
题意:现在有N个部队和M个任务(M>=N),每个部队完成每个任务有一点的效率,效率越高越好。但是部队已经安排了一定的计划,这时需要我们尽量用最小的变动,使得所有部队效率之和最大。求最小变动的数目和变动后和变动前效率之差。
思路:对于如何保证改变最小,没思路,看了别人题解,恍然大悟,表示想法非常机智
试想,如果能让原来那些匹配...
分类:
其他好文 时间:
2014-10-31 17:18:38
阅读次数:
185
// Playground - noun: a place where people can playimport UIKit//import Foundationvar str = "Hello, playground"//swift 新运算符 Nil Coalescing Operator (....
分类:
编程语言 时间:
2014-10-31 15:34:18
阅读次数:
122