POJ 3905 Perfect Election
题目链接
思路:很裸的2-sat,就根据题意建边即可
代码:
#include
#include
#include
#include
#include
using namespace std;
const int MAXNODE = 2005;
struct TwoSet {
int n;
vector ...
分类:
其他好文 时间:
2014-10-27 01:46:37
阅读次数:
183
#include#include#include#include#includeusing namespace std;struct Line{ int a,b,w;};vector line;vector templine;int n;int workline[20010];bool o...
分类:
其他好文 时间:
2014-10-26 22:49:27
阅读次数:
306
這是vector中對string類型排序。
用寫比較函數的方法
#include
#include
#include
#include
#include
#include
using namespace std;
//比較函數,升序排序
bool cmp(const string &x,const string &y) //&符號不能少
{
return x>y...
分类:
编程语言 时间:
2014-10-26 10:25:15
阅读次数:
195
D. 1 Cg 关键字列表 以下是Cg(NVIDIA C for graphics)保留字列表。标有星号的话是不区分大小写的。 除了 ??这个名单上的话,任何以两个的下划线作为前缀(例如,__ newType)的标识符被保留。注意,矩阵(matrix)和向量类型(vector types)(如hal...
分类:
其他好文 时间:
2014-10-26 00:21:03
阅读次数:
246
错误如下:templatevoid temp(std::vector& container){ std::vector::const_iterator p; //error: expected ‘;’ before ‘p’ for(p = container.begin(); p != contai...
分类:
编程语言 时间:
2014-10-25 22:51:55
阅读次数:
217
1 package test; 2 3 import java.io.*; 4 import java.util.*; 5 6 public class Test20 7 { 8 public static void main(String[] args) throws Excepti...
分类:
编程语言 时间:
2014-10-25 20:07:48
阅读次数:
250
STL中的容器按存储方式分为两类,一类是按以数组形式存储的容器(如:vector 、deque);另一类是以不连续的节点形式存储的容器(如:list、set、map)。在使用erase方法来删除元素时,需要注意一些问题。在使用 list、set 或 map遍历删除某些元素时可以这样使用:正确使用方法...
分类:
编程语言 时间:
2014-10-25 18:37:13
阅读次数:
189
HDU 3062 Party
题目链接
2sat模板题
代码:
#include
#include
#include
#include
#include
using namespace std;
const int MAXNODE = 2005;
struct TwoSet {
int n;
vector g[MAXNODE * 2];
bool mar...
分类:
其他好文 时间:
2014-10-25 11:58:33
阅读次数:
167
一、vector的基本概念vector是同一种类型的对象的集合,每个对象都有一个对应的整数索引值。和string对象一样,标准库负责管理存储元素的相关内存。我们把vector称为容器,是因为它可以包含其他对象。一个容器中的所有对象都必须是同一种类型的。使用vector之前,必须包含相应的头文件。#i...
分类:
其他好文 时间:
2014-10-25 10:26:49
阅读次数:
313
本题题目没明确说明有多大的数,主要是A, B < 32768迷惑人,好像不是大数,不过后面 The size of input will not exceed 50K 的这句话就说明是大数了可以为接近无穷大的负数。
其实50K就应该开多大的数组呢?50 * 1024 / 8 == 6400,所以会有6400个数位。
这里直接使用C++的vector或者string,然后输入使用buffer,那么就可以不管数位有多大了。
大数加法比较容易,如果是减法那么题目就比较麻烦了。目前还想不到比较简洁的解法,要特殊处理...
分类:
其他好文 时间:
2014-10-25 08:11:47
阅读次数:
283