- 博客(9)
- 收藏
- 关注
转载 ANDROID drawText实现文字居中
在宽width高height的画布上画一字符串,使字符串水平竖直居中:水平居中很简单,paint.setTextAlign(Align.CENTER);然后drawText的x坐标设置为width / 2即可。
2014-10-29 14:56:13
546
原创 HDOJ1010DFS
#include #include int dx[4]={1,-1,0, 0}; int dy[4]={0, 0,1,-1}; int ii=0,n,m,t,flag; int map[10][10]; char c[10][10]; int abs(int); void dfs(int,int); int main(int argc, char *argv[]) {
2013-11-10 01:09:32
460
原创 poj1703并查集
#include #define maxn 330000 int father[maxn],r[maxn];//r[x]表示该节点相对于根节点的位移量, int find(int x) { int px; px=father[x];//记录父节点 if(father[x]==x)return father[x]; else father[x]=find(father[x]);
2013-11-10 00:55:05
458
原创 poj 1611The Suspects 并查集
最后输出的时候注意遍历每一个数,求每一个数的祖先,如果和0一样就结果加一 #include #include #define maxn 30000 int father[maxn]; int find (int x) { while(father[x]!=x) { x=father[x]; } return x; } int lianjie(int x,int y)
2013-11-03 12:46:33
539
原创 poj 2524 并查集
很水的题,注意输出格式,冒号后面有一个空格 - - #include #define maxn 50000 int father[maxn] ; int ans; int find (int x) { while(father[x]!=x) { x=father[x]; } return x; } int lianjie(int x,int y) { int r
2013-11-03 12:30:43
532
原创 vijos 1034家族 并查集
经典的并查集,最后确认两个数是不是亲戚的时候要两个数都要再找一次祖先,一样的就yes,不一样就no #include #define maxn 5000 int father[maxn] ; int find (int x) { if(x!=father[x])father[x]=find(father[x]); return father[x]; } int lian
2013-11-03 12:28:47
588
原创 hdoj1016Prime Ring Problem
经典搜索,打表应该比函数快,因为最大才20 #include #include int sushu[] = {0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}; void dfs(i
2013-10-28 21:44:33
456
原创 poj2488A Knight's Journey
标准dfs,注意跳出条件 #include #include int xx[8] = {-2, -2, -1, -1, 1, 1, 2, 2}; int yy[8] = {-1, 1, -2, 2, -2, 2, -1, 1}; int map[26][26]; char movex[30]; int movey[30]={1}; int m,p,q; void dfs(int x,i
2013-10-27 22:06:39
370
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人