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 ...
随机推荐
- Mininet加强版——DOT(分布式OpenFlow试验平台)
前言 之前在做SDN实验的时候,需要用到包含2000+个交换机的fattree拓扑,当时用的是mininet,生成整个拓扑需要十五六个小时,最终在异常艰苦的环境下做完了实验,之后听说了有DOT(Dis ...
- [hihoCoder] KMP算法
Each time we find a match, increase the global counter by 1. For KMP, algorithm, you may refer to th ...
- Cocos2d-x学习笔记:CCSprite的使用总结
一.精灵创建及初始化 备注:默认锚点ccp(0.5,0.5),默认位置 ccp(0,0),contentSize为精灵图片尺寸 1.从图片文件创建 2.从帧缓存创建: 3.初始化及自定义大小 4. 从 ...
- 转SpringMVC Controller 返回值的可选类型
spring mvc 支持如下的返回方式:ModelAndView, Model, ModelMap, Map,View, String, void. ModelAndView @RequestMap ...
- 查看linux目录剩余空间大小
df命令是linux系统以磁盘分区为单位查看文件系统,可以加上参数查看磁盘剩余空间信息,命令格式: df -hl 显示格式为: 文件系统 容量 已用 可用 已用% 挂载点 Filesystem S ...
- mysql 中用户默认密码加密问题
问题描述: 在mysql中 user表中新增用户默认密码为123456,但是在数据库中显示不能为明文,而mysql的默认字段不能用函数 解决方法: 用触发器 delimiter | drop trig ...
- tcp连接是基于socket通信的吗
https://zhidao.baidu.com/question/1305788160020716299.html ------ 网络七层协议 五层模型 TCP连接 HTTP连接 socket套接字 ...
- celery中的生产者消费者问题
celery中的生产者消费者问题 在task1.py文件中: # demo1:task.py and celery.py in one file# run it byfrom celery impor ...
- 安全必须作为基础,融入到产品开发过程——By Me
安全必须作为基础融入,让公司兄弟姐妹具备足够的安全意识,且逐渐具备必要的安全经验,带着安全思维去执行产品的架构设计.研发.测试.运维(甚至完整的产品生命周期),这是一种有远见.负责人的产品过程!! 下 ...
- Android Wear - Design Principles for Android Wear(设计原则)
---------------------------------------------------------------------------------------------------- ...