摘要: 2—sat建图总结1.元素关系有以下11种A[x]NOT A[x]A[x] AND A[y]A[x] AND NOT A[y]A[x] OR A[y]A[x] OR NOT A[y]NOT (A[x] AND A[y])NOT (A[x] OR A[y])A[x] XOR A[y]NOT (A[x] XOR A[y])A[x] XOR NOT A[y] And 结果为1:建边 ~x->y, ~y->x (两个数都为1)And 结果为0:建边 y->~x , x->~y(两个数至少有一个为0)OR 结果为1:建边 ~x->y , ~y->x(两个数至少有一个为 阅读全文
posted @ 2012-11-03 23:57 'wind 阅读(758) 评论(0) 推荐(0) 编辑
摘要: 题意: Zty很痴迷数学问题.。一天,yifenfei出了个数学题想难倒他,让他回答1 / n。但Zty却回答不了^_^. 请大家编程帮助他.输出1/n. (是循环小数的,只输出第一个循环节).分析: 找循环节的时候看看是否出现了相同的被除数即可。#include <stdio.h>#include <string.h>#define maxn 100010#define clr(x) memset(x,0,sizeof(x))int res[maxn];int vis[maxn];int main(){ int top, i; int k, t, n; scanf(& 阅读全文
posted @ 2012-11-03 14:00 'wind 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 题意: 知道了 n 个人的坐标和一个边长为R的正方形,问正方形内最多可以包含多少人。分析:离散化坐标,将y坐标映射到区间上,按x坐标从小到达扫描。#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;#define maxn 10005long long max(long long a, long long b){ return a>b?a:b;}struct seg{ long long x, y, val;}s[maxn*2];int add[max 阅读全文
posted @ 2012-11-03 13:09 'wind 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 题意: 有n 个砖块,有不同的长宽高,分为三种类型,要求是: When di = 0 the block's length and width must be more or equal to the block's length and width which lies under the block. When di = 1 the block's length and width must be more or equal to the block's length which lies under the block and width and the 阅读全文
posted @ 2012-11-03 00:19 'wind 阅读(353) 评论(0) 推荐(0) 编辑