2005年上海交通大学计算机研究生机试真题
http://ac.jobdu.com/problem.php?pid=1090 路径打印
#include<iostream>
#include<set>
#include<string>
#include<cstdio>
using namespace std;set<string> iset;
string str,front_str;
int main(void)
{int i,j,k,n;while(scanf("%d",&n)!=EOF){if(!n)break;iset.clear();for(i = 0 ; i < n ; ++i){cin>>str;iset.insert(str); //set集合中的元素默认是按升序来排列的}set<string>::iterator it,iter = iset.begin();str = *iter;for(i = 0 ; i < str.size() ; ++i){if(str[i]=='\\'){if(i < str.size()-1){puts("");for(j = 0 ; j <=i ; ++j)putchar(' ');}}elseputchar(str[i]);}for(++iter; iter != iset.end() ; ++iter){str = *iter;it = iter;front_str = *(--it);j = 0;while(str[j] && str[j] == front_str[j])j++;while(j>0 && str[j] != '\\') //为了处理下面这个情况 a\bd\dj--; // a\bt\pif(str[j] == '\\')j++;for(i = j ; i < str.size() ; ++i){if(str[i] == '\\'){if(i < str.size()-1){puts("");for(k = 0 ; k <= i ; ++k)putchar(' ');}}else{if(i == j){puts(""); //输出每行后面的那个换行符for(k = 0 ; k < i ; ++k)putchar(' ');}putchar(str[i]);}}}puts("");puts("");}return 0;
}
2005年上海交通大学计算机研究生机试真题相关推荐
- 211大学计算机复试不机试,复试机试之上海交通大学计算机研究生机试真题.doc...
复试机试之上海交通大学计算机研究生机试真题 (你自己回去改格式啊,这个有多重繁杂字体,你自己改好看点~~还有知识05年到11年的)复试机试之2011年上海交通大学计算机研究生机试真题 (2012-02 ...
- 上海交大研究生计算机考研真题,2011年上海交通大学计算机研究生机试真题
Oracle 约束(constraint)的几个参数的小研究 ORACLE中,约束分deferred 跟 immediate 2种: deferred:如果 Oracle 在事务提交(commit)时 ...
- 2011年上海交通大学计算机研究生机试真题
http://ac.jobdu.com/problem.php?pid=1103 二次方程计算器 #include<iostream> #include<cstdio> #in ...
- 2006年上海交通大学计算机研究生机试真题
http://ac.jobdu.com/problem.php?pid=1095 2的幂次方 //手动模拟 #include<iostream> #include<string> ...
- 2000年华中科技大学计算机研究生机试真题 对称矩阵
题目1180:对称矩阵 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2518 解决:1295 题目描述: 输入一个N维矩阵,判断是否对称. 输入: 输入第一行包括一个数:N(1<= ...
- 2008--2009年北京航空航天大学计算机研究生机试真题
http://ac.jobdu.com/problem.php?pid=1165 字符串匹配 #include<iostream> #include<cstdio> #incl ...
- 2011年北京大学计算机研究生机试真题(dijkstra+优先队列)
http://ac.jobdu.com/problem.php?pid=1162 I Wanna Go Home 方法一:普通的dijkstra /* 很明显的最短路,但关键是如何建图.可以看到,一 ...
- 2010年清华大学计算机研究生机试真题
http://ac.jobdu.com/problem.php?pid=1085 求root(N, k) /* N =a0+a1*k+a2*k^2+......ar*k^r; N'=a0+a1 +a ...
- 2006年清华大学计算机研究生机试真题
http://ac.jobdu.com/problem.php?pid=1078 二叉树遍历 #include<stdio.h> #include<string.h>//二叉树 ...
最新文章
- python多线程爬虫实例-Python3多线程爬虫实例讲解代码
- IIS6下PHP的ISAPI和FastCGI性能比较 期待ii7
- ccf-csp #201709-2 公共钥匙盒
- VTK:可视化之Lorenz
- 【Http协议】深入理解HTTP协议
- 这4个小程序为什么有很多人在用,仅仅是因为不占手机内存空间?
- Python之父再度发声:我们能为中国的“996”程序员做什么?
- js 阻止冒泡 在控件的 onxxx 事件中调用就可以阻止父控件也响应消息了
- Win10如何配置数据源ODBC数据源
- matlab实验十ask,matlab实验十ASK调制与解调实验
- 《21天学通C语言》
- 什么是全栈工程师,为什么全栈开发用Python,Python web全栈开发究竟有多高薪?
- 计算机字符编码从0/1到UTF-8
- 解决iconfont 图标不显示问题
- 网络:IP基础知识总结
- win10怎么更改c盘用户计算机名,详解win10系统更改c盘用户名文件夹名称的设置技巧...
- python获取当前时间、今天零点、23:59:59点、昨天当前时间、明天的当前时间。
- 直播带货开发,实现主播和用户连麦的方式
- Android给图片加水印
- 整理oracle Hints 用法大全