博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 4409 Family Name List
阅读量:7080 次
发布时间:2019-06-28

本文共 1035 字,大约阅读时间需要 3 分钟。

#include 
#include
#include
#include
#include
using namespace std;int main(){ // freopen("test.txt","r",stdin); int n,q; while(scanf("%d",&n)&&n) { map
>son; map
father; map
gen; map
temp; char str[61]; scanf("%s",str); gen[0]=string(str); temp[str]=0; for(int i=1;i
s; s.push(gen[0]); while(s.size()) { string name=s.top(); for(int j=0;j
::reverse_iterator it=son[name].rbegin();it!=son[name].rend();++it) s.push(*it); } } if(order[0]=='b') { string name; cin>>name; if(temp[name]==0) printf("1\n"); else printf("%d\n",son[father[name]].size()); } if(order[0]=='c') { string name1,name2; cin>>name1>>name2; name1=father[name1]; name2=father[name2]; while(temp[name1]!=temp[name2]) { if(temp[name1]>temp[name2]) name1=father[name1]; else name2=father[name2]; } while(name1!=name2) { name1=father[name1]; name2=father[name2]; } cout<
<

  

转载于:https://www.cnblogs.com/xiuyangleiasp/archive/2012/10/30/2746424.html

你可能感兴趣的文章
杨博:医疗大数据服务任重道远
查看>>
Mysql复制技术中的主键冲突
查看>>
iptables
查看>>
算法训练 删除数组零元素
查看>>
2014牡丹江网络zoj3816Generalized Palindromic Number(dfs或者bfs)
查看>>
有源音箱和无源音箱的主要区别
查看>>
浅谈性能测试、压力测试和负载测试
查看>>
视频02.MediaPlayer和VideoView,TextureView的使用
查看>>
thinkphp-union
查看>>
Android JSON解析库Gson和Fast-json的使用对比和图书列表小案例
查看>>
日本展示机器人Erica,看脸还不错
查看>>
一步一步搞定InfoPath(01)——提交表单到Access数据库
查看>>
SET 语句选项
查看>>
ubuntu ufw防火墙
查看>>
加载AI,让好奇号学会了自我决策
查看>>
阿里云API应用创新大赛总决赛,强者之争即将开启
查看>>
用yum工具下载一个rpm包
查看>>
「镁客·请讲」杨毅:用全新“制阻系统”颠覆整个VR骑行
查看>>
poj1006生理周期(中国剩余定理)
查看>>
Linux & Oracle目录说明
查看>>