uva10562 Undraw the Trees
来源:互联网 发布:sql where执行顺序 编辑:程序博客网 时间:2024/06/05 11:53
简简单单 单单纯纯 我就是想坚持下去 到以后发现我竟然是这样入门的 自己是不是都会觉得很奇葩
#include<cstdio>#include<cctype>#include<cstring>using namespace std;const int maxn = 200 + 10;int n;char buf[maxn][maxn];void dfs(int r, int c) { printf("%c(", buf[r][c]); if(r+1 < n && buf[r+1][c] == '|'){ int i = c; while(i-1 >= 0 && buf[r+2][i-1] == '-') i--; while(buf[r+2][i] == '-' && buf[r+3][i] != '\0'){ if(!isspace(buf[r+3][i])) dfs(r+3, i); i++; } } printf(")");}void solve(){ n = 0; for(;;){ fgets(buf[n], maxn, stdin); if(buf[n][0] == '#') break; else n++; } printf("("); if(n){ for(int i = 0; i < strlen(buf[0]); i++) if(buf[0][i] != ' ') { dfs(0, i); break; } } printf(")\n");}int main(){ int T; fgets(buf[0], maxn, stdin); sscanf(buf[0], "%d", &T); while(T--) solve(); return 0;}
0 0
- UVA10562 - Undraw the Trees
- UVA10562- Undraw the Trees
- Undraw the Trees UVA10562
- uva10562 Undraw the Trees
- uva10562 Undraw the Trees
- uva10562 -- Undraw the Trees
- Uva10562——Undraw the Trees
- uva10562 Undraw the Trees (不定叉树重建)
- 例题6-17 UVa10562 Undraw the Trees(树)
- uva10562 Undraw-the-Trees 字符题处理 递归
- Uva10562 Undraw the Trees 【递归建树】【例题6-17】
- uva10562 - Undraw the Trees 入门经典II 第六章数据结构基础 例题6-17
- 10562 - Undraw the Trees***
- 10562 - Undraw the Trees
- UVaOJ10562---Undraw the Trees
- 10562 - Undraw the Trees
- 10562 - Undraw the Trees
- 10562 - Undraw the Trees
- flume要删,安装,使用
- Mechanize对WEB的操作
- poj 3630 Phone List trie
- TabHost+RadioGroup实现底部导航栏
- PHP 如何获取当前的域名
- uva10562 Undraw the Trees
- 【转载】sip协议介绍
- 翻译经典之《Cisco Lan Switching》第六章 理解生成树(三):生成树协议的两个关键概念
- uva-10815 - Andy's First Dictionary
- 文章标题
- java常用API
- iOS开发-autolayout动画效果实现的几种方法
- printf 函数问题
- Android签名与认证详细分析之一