摘要:状态DP
阅读全文
随笔分类 - poj
摘要:DescriptionIn a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without crashing into each other. Of course, all warehouses are rectangular, and all robots occupy a circular floor space with a diameter of 1 meter
阅读全文
摘要:DescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith right parenthesis in S (P-sequence). q By an integer sequence W = w1 w2...wn where for each
阅读全文
摘要:DescriptionWFF 'N PROOF is a logic game played with dice. Each die has six faces representing some subset of the possible symbols K, A, N, C, E, p, q, r, s, t. A Well-formed formula (WFF) is any string of these symbols obeying the following rules:p, q, r, s, and t are WFFsif w is a WFF, Nwis a W
阅读全文
摘要:DescriptionAccounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc. All what they remember is that MS Inc. posted a surplus or a deficit each month of 1999 and each month when MS Inc. posted surplus, the amount of surplu
阅读全文
摘要:DescriptionCurrent work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. Work in this area has resulted in the practical use of results from number theory and other branches of mathematics once considered to be only of theoretical
阅读全文
摘要:DescriptionAssume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locating on the coasting, can only cover d distance, so an island in the sea can be covered by a radius i
阅读全文
摘要:DFS+状态位View Code 1 #include<iostream> 2 using namespace std; 3 4 int chess=0; 5 int step; 6 bool flag=false; 7 int ri[16],cj[16]; 8 9 bool isopen(void)10 {11 if(chess==0xFFFF)12 return true;13 else14 return false;15 }16 17 void flip(int bit)18 {19...
阅读全文
摘要:枚举#include <iostream>using namespace std;void flip(int* a,int i){ int row,col; row=i/4+1; col=i%4+1; a[i]=1-a[i]; for(int j=0;j<4;j++) { a[j+4*(row-1)]=1-a[j+4*(row-1)]; a[4*j+col-1]=1-a[4*j+col-1]; }}bool check(int* a){ int sum=0; for(int i=0;i<16;i++) { ...
阅读全文
摘要:DFSDFS#include<iostream>using namespace std;bool map[6][6],flag=0;int dir[5][2]={{0,0},{0,1},{1,0},{-1,0},{0,-1}};int step;void flip(int row,int col){ for(int i=0;i<5;i++) { int x=row+dir[i][0]; int y=col+dir[i][1]; map[x][y]=!map[x][y]; }}bool check(){ int i,j; f...
阅读全文
摘要:枚举法参考点灯游戏枚举#include <iostream>using namespace std;void flip(int* a,int i){ a[i]=1-a[i]; if(i>3) a[i-4]=1-a[i-4]; if(i<12) a[i+4]=1-a[i+4]; if(i%4!=0) a[i-1]=1-a[i-1]; if((i+1)%4!=0) a[i+1]=1-a[i+1];}bool check(int* a){ int sum=0; for(int i=0;i<16;i++) { sum+=a[i]; }...
阅读全文
摘要:OJ上的一些水题(可用来练手和增加自信)(poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法: (1)图的深度优先遍历和广度优先遍历. (2)最短路径算法(dijkstra,bellman-for
阅读全文
摘要:DescriptionPerhaps you have heard of the legend of the Tower of Babylon. Nowadays many details of this tale have been forgotten. So now, in line with the educational nature of this contest, we will tell you the whole story: The babylonians had n types of blocks, and an unlimited supply of blocks of
阅读全文
|