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 ...
随机推荐
- [LintCode] 合并排序数组
A subroutine of merge sort. class Solution { public: /** * @param A and B: sorted integer array A an ...
- English Grammar
What is Grammar?
- “CMake”这个名字是“cross platform make”
cmake_百度百科 https://baike.baidu.com/item/cmake/7138032?fr=aladdin CMake 可以编译源代码.制作程序库.产生适配器(wrapper). ...
- ubuntu微信
方法1 – 使用Snap来安装微信 依次在terminal 执行一下命令 sudo apt install snapd snapd-xdg-open sudo snap install electro ...
- 我的Android进阶之旅------>Android Studio使用statistics插件统计项目代码总行数
今天公司说要统计一下项目总共了多少行代码,于是上网看了一下使用statistic插件可以统计代码总行数,下面给大家分享一下 ! 1.下载[statistic]插件 首先当然要把名为[statistic ...
- tornado.web.StaticFileHandler
tornado.web.StaticFileHandler 源代码中的解释 class StaticFileHandler(RequestHandler): """A s ...
- 吴超老师课程--Sqoop的安装和介绍
SQOOP是用于对数据进行导入导出的. (1)把MySQL.Oracle等数据库中的数据导入到HDFS.Hive.HBase中 (2)把HDFS.Hive.HBase中的数据导出到MySQ ...
- Taking a screen shot of a window using Delphi code is rather easy.
Taking a screen shot of a window using Delphi code is rather easy. A screen shot (screen capture) is ...
- rails timeout 异常
发现经常有”超时“的错误信息,如/usr/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::Error),恩 ...
- Python 实习遇见的各种面试题
Python 语法 说说你平时 Python 都用哪些库 == 和 is 区别. == 是比较两对象的值,is 是比较在内存中的地址(id), is 相当于 id(objx) == id(objy). ...