PAT1077. Kuchiguse (20)
#include <iostream>
#include <vector>
#include <sstream>
using namespace std; int n;
string c[100];
string res;
int fir=1;
int ok=0;
string line;
int main()
{
cin>>n;
getline(cin,line);
for(int i=0;i<n;i++){
ok=0;
getline(cin,line);
c[i]=line;
int p=res.size()-1,q=c[i].size()-1;
while(p>=0&&q>=0){
if(res[p]==c[i][q]){
p--;q--;
}else{
break;
}
}
if(fir){
res=c[i];
fir=0;
}else{
res=c[i].substr(q+1);
}
}
if(res.size()==0) cout<<"nai"<<endl;
else cout<<res;
return 0;
}
PAT1077. Kuchiguse (20)的更多相关文章
- PAT1077: Kuchiguse
1077. Kuchiguse (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 HOU, Qiming The Japan ...
- 1077. Kuchiguse (20)【字符串处理】——PAT (Advanced Level) Practise
题目信息 1077. Kuchiguse (20) 时间限制100 ms 内存限制65536 kB 代码长度限制16000 B The Japanese language is notorious f ...
- PAT 甲级 1077 Kuchiguse (20 分)(简单,找最大相同后缀)
1077 Kuchiguse (20 分) The Japanese language is notorious for its sentence ending particles. Person ...
- 1077. Kuchiguse (20)
The Japanese language is notorious for its sentence ending particles. Personal preference of such pa ...
- PAT Advanced 1077 Kuchiguse (20 分)
The Japanese language is notorious for its sentence ending particles. Personal preference of such pa ...
- PAT甲级——1077.Kuchiguse(20分)
The Japanese language is notorious for its sentence ending particles. Personal preference of such pa ...
- PAT (Advanced Level) 1077. Kuchiguse (20)
最长公共后缀.暴力. #include<cstdio> #include<cstring> #include<cmath> #include<vector&g ...
- PAT甲题题解-1077. Kuchiguse (20)-找相同后缀
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...
- PAT A1077 Kuchiguse (20)
晴神书中AC代码 #include <cstdio> #include <cstring> #include <iostream> using namespace ...
随机推荐
- 【Linux】命令学习笔记和总结
莫名的想学习一下Linux了,因为对这方面的知识储备为0.对于命令行界面始终是零接触零了解,对一个程序员来说这几乎是致命的,所以简单了解一下. 一.教程参考 参考菜鸟教程即可: Linux 教程 | ...
- Scala学习之For、Function、Lazy(4)
1.for的使用 for的使用在各种编程语言中是最常见的,这里只是聊聊for在Scala中的表现形式,由于Scala语言是完全面向对象的,所以直接导致for的不同呈现,下面举几个例子说明一下 obje ...
- delphi----Tstringlist,将有符号的数据变成数组"aaa,bbb,ccc"---->list[0]=aaa,list[1]=bbb
//TStringList 常用方法与属性: var List: TStringList; i: Integer; begin List := TStringList.Create; ...
- Linux磁盘分区的理解
磁盘分割: 一块磁盘可以被分割为多个分区artition. 磁盘链接的方式 正常的实体机使用的都是/dev/sd[a-]的硬盘档名 虚拟机可能会使用/dev/vd[a-p]这种装置档名 SATA/US ...
- Career Planning:Developers Best Practices Tutorial
This small tutorial is based on my past 16+ years of experience in software development industry. I ...
- tomcat和jboss的区别
1. Tomcat是Apache鼎力支持的Java Web应用服务器(注:servlet容器),由于它优秀的稳定性以及丰富的文档资料,广泛的使用人群,从而在开源领域受到最广泛的青睐. 2. Jboss ...
- caffe杂
一.finetune命令: mpirun /home/zhangsuosheng/caffe_mpi/build/tools/caffe train -solver solver.prototxt - ...
- shader常用
1 模型空间转裁剪空间 UnityObjectToClipPos(v.vertex) 2 模型空间转世界空间 mul( unity_ObjectToWorld, v.vertex ) 3 雾三件套 U ...
- 使用idea的条件断点快速定位注解的处理类
看代码时会碰到注解的处理类难定位的情况,比如spring的某个注解我们想知道到底是谁在处理他,他起什么作用,通过普通的代码搜索功能不容易找到,比如好用的方法就是条件断点. 比如下断:Accessibl ...
- Windows Server 2016 下执行定时任务(英文系统)
Step1. 找到“控制面板(Control Panel)” 打开 “管理工具(Administrative Tools)” Step2. 打开“任务计划(Task Schedule)” Step3. ...