- 博客(44)
- 资源 (10)
- 收藏
- 关注
原创 Topcoder SRM 505 Div 2 hard
这题解法非常巧妙。最关键的一点是, 先由题目想到这个:要知道整个矩形的面积,必须知道所有 X[i] /X[j]的值,同时也必须知道X[i] * Y[j] (0然后就是用UnionFind来做了
2011-09-21 20:37:29
457
原创 Ogre 相关老代码-- 第一部分
<br />// CattonShading.cg<br />void vs_main(<br /> <br /> in float4 pos : POSITION,<br /> in float4 norm : NORMAL,<br /> in float2 uv : TEXCOORD0,<br /> uniform float4x4 worldMat,<br /> uniform float4x4 viewProjMat,<br /> uniform float4 eyePos,<b
2010-11-08 22:38:00
609
原创 Note the difference!!!
//header for algorithm#include#include#include#includeusing namespace std;//========Correctbool canWin(int a, int b){ if(b/a>1 || b==a) return true; return !canWin(b-a, a);}//=
2010-05-28 10:03:00
402
原创 poj 2411 动态规划
http://acm.pku.edu.cn/JudgeOnline/problem?id=2411 计算一个矩形用1x2小矩形填充的“不同填充法数量” 假设我们要从第一列开始填充, 填充完第一列, 再填充第二列 这样在填充当前列的某个未填充格子的时候,只有两个选择,横放、竖放 由于在填充第一列的时候,可能横放了一些格子,那么在开始第二列填充时,有些格子已经被覆盖了
2010-05-19 12:37:00
682
原创 红黑树的topdown-remove
红黑树的bottomup-insert很容易实现, 而删除就不容易, 今天抄成功了Julienne Walker发在他网站上的算法, 为备忘, 总结一下。 首先, 删除red 节点, 不影响红黑树的有效性。利用这一点,我们寄希望于可以把其他情况都转化成删除红色节点。 其次, 跟在Binary search tree中一样, 删除一个节点K可以转化为 1,先找到这个节点的in
2009-12-18 21:10:00
408
原创 表达式求值
#include #include string> #include using namespace std; const int PLUS = -1,MINUS=-2,MUL=-3,DIV=-4,LPREN=-5,RPREN=-6,EOE=-7; string expr; int pos; int NextToken() { int t=0;
2009-10-26 18:21:00
324
原创 计算 高次幂相对某个模数的余( (a ^ n)mod p, n 很大 )
在做google codejam 2008 round 1A problem C 的 时候, 从别人代码里学到的 假如 要计算 (a ^ n) , n很大, 直接计算的话, 是个 O(n)的方法有 O(log (n))的方法,如下: 把n表示成2进制, n = n0 * 1 + n1 * 2 + n2 * 4 + ... + nk * (2^k)则 a^n =[
2009-09-10 13:27:00
1253
1
原创 google codejam 2009 Qualification Round Problem C code
#include #include #include using namespace std;const string b("welcome to code jam");//const string b("a");const int MAXLEN = 501; const int m = b.length();int n;string a;int cnt[MAXLEN][20];v
2009-09-04 13:21:00
506
原创 google codejam 2008 APAC local onsites , Problem A What are Birds?
题目在这里http://code.google.com/codejam/contest/dashboard?c=32005# 这题先把问题转化一下, 相当于: 在平面上有一个矩形, 现在知道有一些点于这个矩形的关系。 请根据这些信息, 判断能否确定另一些点与这个矩形的关系 代码如下: #include #include #include using
2009-08-28 13:08:00
529
原创 在UltraEditor ogre material 和 vs_3_0语法高亮显示
找到 wordfile.uew在文件尾加入以下内容,然后把你的vs_3_0的程序都用.vs3扩展名,用UE打开就能(部分)高亮显示了( 有些关键词未搜集完整, 先用着吧 )/L15"Vertex Shader 3.0" Line Comment = ; Line Comment Alt = // File Extensions = VSH3 vs3/Delimiters = [] +
2009-04-23 14:56:00
1868
1
原创 POJ1097 Roads Scholar
#include #include #include #include using namespace std;const int MAXN = 30;const int MAXDIST = 100000000;int distanc[MAXN][MAXN];//从交点a到b的最短距离 int dist[MAXN][MAXN];//从
2009-01-08 12:45:00
1145
原创 zoj 1909 Square
#include #include using namespace std;int len[20];int average;int n;int occ[20];bool formSquare(int i, int j, int amount){ if (amount return false; if (amount ==
2008-10-31 15:50:00
642
原创 zoj 1095 Humble Numbers
#include #include using namespace std;const int factors[] = { 2, 3, 5, 7 };const int m = 2000000000;const int mm[] = { m/2, m/3, m/5, m/7 };const char* st = "st", *nd = "nd", *rd =
2008-10-31 12:41:00
627
原创 ZOJ 1102 Phylogenetic Trees Inherited (My algorithm , Time limit exeeded)
#include #include using namespace std;int n, l;string s[1025];int cnt[1025][26];string result;inline bool input(){ cin>>n>>l; if ( !n && !l ) return false; for
2008-10-30 10:09:00
820
原创 zoj 1104
/*** 由于抛物线经过点(0,0), (D, 0),设抛物线方程为 y = -Ax(x-D), 其中(D, 0)为落地点。* 再由参数方程 x = v0*t*cosO y = -0.5*g*t^2 + v0*t*sin0 消去参数得 y = -[g/(2*v0^2*cos0^2)]*x^2 + tan0 *x 与前面方程比较
2008-09-03 13:36:00
530
原创 zoj 1166 Anagram Checker
/**A seach problem.**/#include #include #include #include #include using namespace std;/**dictionary words**/string word[2000];/**Word in phrase**/string swo
2008-08-07 10:23:00
851
原创 zoj1163 The Staircases 解法1 O(n^3)
#include #include using namespace std;int main(int argc, char *argv[]){ long long a[501][501], b[501]; memset(a, 0, sizeof(a)); memset(b, 0, sizeof(b)); for (int
2008-08-06 11:33:00
752
5
原创 zoj1155 triangle war
/**DP 对状态编号, 18条边, 每条边可能实线, 也可能虚线, 有2^18种MaxScore(x) = max { StepScore(rCode, selectedEdgeNum) > 0 ? StepScore + MaxScore(rCode) //选择的边成三角行
2008-08-01 17:23:00
957
原创 zoj1136 Code
#include #include #include #include #include using namespace std;struct item{ string s; int r; //modulo n};int main(int argc, char *argv[]){ int n, m; int d[10]; while (cin
2008-07-30 13:10:00
740
原创 zoj1136 Multiple
MultipleTime limit: 10 Seconds Memory limit: 32768K Total Submit: 2845 Accepted Submit: 764 a program that, given a natural number N between 0 and 4999 (inclusively), and M distinc
2008-07-30 13:07:00
712
原创 zoj1301 Code
#include #include #include using namespace std;struct status{ int lightBits, room, step; struct status *next;}status[1024][10];struct door{ int r1, r2;
2008-07-25 08:46:00
537
原创 zoj1301 The New Villa
The New VillaTime limit: 1 Seconds Memory limit: 32768K Special JudgeTotal Submit: 1036 Accepted Submit: 331 Mr. Black recently bought a villa in the countryside. Only one thing
2008-07-25 08:35:00
624
原创 zoj 1144 Robbery
#include #include using namespace std;int a[100][100][100];int b[100];int bx[100], by[100];int W, H, T;int main(int argc, char *argv[]){ int n;
2008-07-11 14:07:00
708
原创 zoj 1134
#include #include #include #include using namespace std;struct node{ vector children; int name; int mSoldiers[2]; int getMin(int i);} no
2008-07-10 14:03:00
443
原创 Google code jam 2008 beta B The Price is Wrong
#include #include #include #include #include using namespace std;struct Prod{ char name[30]; int id;}prod[64], temp[64];int ord[64];int pric
2008-07-10 09:32:00
569
原创 Google code jam 2008 beta A Triangle Trilemma
#include #include #define X 0#define Y 1using namespace std;typedef int pointi[2];int AreaSign(pointi a, pointi b, pointi c){ double x1 = b[X]-a[X], x2 = c[X]-a[
2008-07-09 08:51:00
490
原创 zoj 2110 -- 未解决
#include #include #include #include #include using namespace std;int blk[6][6];int sx, sy, dx, dy;int n, m, t;int dist[6][6];bool Search(int x , int
2008-07-07 15:00:00
324
原创 ZOJ 1128
#include #include #include using namespace std;struct Rect{ double up, left, right, bottom; Rect* next; void insert(double u, double l, double r, double b);
2008-07-07 11:00:00
526
原创 zoj1119 SPF
#include #include #include #include using namespace std;struct Edge{ int to; Edge*next; void insert(Edge* e) { e->nex
2008-07-04 11:10:00
793
1
原创 zoj 1711 Sum It Up
#include #include #include using namespace std;struct Num{ int v, q;}num[12];int t, n;int qty[12];int cnt, j;void Test(int p){ if (p =
2008-07-03 13:38:00
483
原创 zoj 1111 Poker Hands
#include #include using namespace std;struct Card{ char type; int value; Card* next;};void Insert(Card* hand, Card* c){ Card* p =
2008-07-01 17:31:00
712
原创 zoj 1028 Flip and Shift
/**证明: 首先, 若n为奇数,则必然可以完成任务 将n个球遍号为1,2,...,n 若从1位置开始,进行 n-1次连续的 (flip, shift, shift), 则 除了球1外, 所有球的位置都 减了2, 而球1最后到达原来球n-1的位置。(见图, 可以知道, 相当于交换球1和2的位置)
2008-06-25 09:21:00
1387
原创 ZOJ 1025 Wooden sticks
#include #include using namespace std;struct node{ int len, wt; node* nxt;};node* list=NULL;void Insert(node* lst, int l, int w){
2008-06-24 14:23:00
605
原创 ZOJ 1093 Monkey and banana
#include #include #define MAXN 30#define MAX(a, b) a>b?a:b#define MIN(a, b) a>b?b:ausing namespace std;struct Block{ int w, l, h;}blks[3*MAXN];int n;
2008-06-24 12:54:00
793
原创 ZOJ 1039 尚未解决
#include #include #include #define MAX (1024*512)using namespace std;int BIT[19];int win[MAX];void PrintBit(int a){ int k = 1; for
2008-06-20 11:25:00
491
原创 zoj 1011NTA
//#include #include #define MAXN 15 #define MAXK 10#define MAXL 10using namespace std;int m, n, k;struct mypair{ int a, b; mypair *next;
2008-06-19 15:54:00
1447
1
windows resource kit tools for windows xp
2009-01-07
Windows resurce kit tools for winxp
2009-01-07
Microsoft Windows Internals, tools package
2009-01-07
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人