UVA297 Quadtrees(递归!!!)
来源:互联网 发布:淘宝宝贝说明图片大小 编辑:程序博客网 时间:2024/05/07 23:38
注释以后补!!!
#include<cstdio>#include<cstring>const int len = 32;const int maxn = 1024+10;char s[maxn];int buf[len][len], cnt;void draw(const char* s, int& p, int r, int c, int w) { char ch = s[p++]; if(ch == 'p') { draw(s, p, r, c+w/2, w/2); draw(s, p, r, c, w/2); draw(s, p, r+w/2, c, w/2); draw(s, p, r+w/2, c+w/2, w/2); }else if(ch == 'f'){ for(int i = r; i < r+w; i++) for(int j = c; j < c+w; j++) if(buf[i][j] == 0) { buf[i][j] = 1; cnt++; } }}int main(){ int T; scanf("%d", &T); while(T--){ memset(buf, 0, sizeof(buf)); cnt = 0; for(int i = 0; i < 2; i++) { scanf("%s", s); int p = 0; draw(s, p, 0, 0, len); } printf("There are %d black pixels.\n", cnt); } return 0;}
0 0
- UVA297 Quadtrees(递归!!!)
- Uva297 Quadtrees【递归建四分树】【例题6-11】
- Uva297 Quadtrees【递归建四分树】【例题6-11】
- Quadtrees UVA297
- uva297 - Quadtrees
- UVA297 - Quadtrees
- 例题6-11 UVa297 Quadtrees(四分树)
- UVa297 例题6-11 四分树(Quadtrees)
- Uva297——Quadtrees
- [UVA297] Quadtrees 四叉树
- uva297 Quadtrees (树的重建)
- UVa 297 Quadtrees 递归
- 【UVA297】四象树(BZOJ2664)
- uva297
- UVA297
- uva297
- uva297
- UVA297
- JavaScript中的内置对象
- emacs以root权限打开文件
- POJ-1005 I Think I Need a Houseboat
- jsTree是什么?
- Centos操作mysql问题集锦
- UVA297 Quadtrees(递归!!!)
- maven下进行单元测试
- Part2. 使用Visual Studio把C代码编译成.dll文件
- 如何计算点到线段的距离
- webkit browser 相关开发 经典博客与网站
- Android onActivityResult获取返回值的用法
- 开源网站大全
- 【SICP练习】14 练习1.20
- Fragment中onActivityResult不响应