摘要: 把a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0 变换成 a1x13+ a2x23+ a3x33=—( a4x43+ a5x53 )这步很重要。这样这个题就变成了,在一个很大的数组里,查找一个数是否存在,存在的话有几个?View Code #include <stdio.h>#include <algorithm>using namespace std;int ar1[1000010],ar2[10010],cnt1,cnt2,ans;void judge(int a){ int i,l=0,r=cnt2,mid; while (l<=r) 阅读全文
posted @ 2011-12-02 11:40 104_gogo 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 由poj 2083想到,从坐标(1,1)到(x,y)都是有公式的,所以只需给每个地方找到对应的公式就好了View Code #include <stdio.h>#include <math.h>#include <string.h>int p;char ch,map[3005][3005],ans[30][30];void dfs(int n,int x,int y){ int i,j,size; if(n==1) { map[y-1][x-1]=ch; return; } size=pow(p*1.0,n-2); for (i=... 阅读全文
posted @ 2011-12-02 11:33 104_gogo 阅读(449) 评论(0) 推荐(0) 编辑
摘要: 注意这个道题的行和列,别混乱了View Code #include <stdio.h>#include <string.h>#include <math.h>char map[3000][3000];void dfs(int n,int x,int y){ int size; if(n==1) { map[x][y]=map[x-1][y+1]='/'; map[x][y+3]=map[x-1][y+2]='\\'; map[x][y+1]=map[x][y+2]='_'; return; } size=po. 阅读全文
posted @ 2011-12-02 11:27 104_gogo 阅读(376) 评论(0) 推荐(0) 编辑
摘要: 今天一共做了3道分形的题,开始没弄对,后面明白解题思想是从1个地方变到n个地方,就很简单了。View Code #include <stdio.h>#include <math.h>int n;char map[1000][1000];void dfs(int n,int x,int y){ int size; if(n==1) { map[x][y] = 'X'; return; } size = pow(3.0,n-2); dfs(n-1,x,y); dfs(n-1,x+2*size,y); dfs(n-1,x+s... 阅读全文
posted @ 2011-12-02 11:25 104_gogo 阅读(192) 评论(0) 推荐(0) 编辑