AC代码 #include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; cin.ignore(); //吸收\n //输入 bool flag=true; char ans[257]; //*测试点3:数组大小 for(int i=0;i<n;i++){ char word
1077 Kuchiguse The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personality. Such a preference is called “Kuchiguse” and is often exaggerated
1. 题目 The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called "Kuchiguse" and is often exaggerat
1077 Kuchiguse (20 分) 题目大意 给定N给字符串,求他们的公共后缀,如果不存在公共后缀,就输出“nai” 基本思路 求公共后缀太麻烦了,我们可以来比较前缀,所以每读入一个的时候都把它反转,这样就可以比较前缀了。 读入第一个字符串ans,求出其长度len1后反转。 然后循环n-1次,读入剩下
A1077 Kuchiguse (找字符串相同字符串) The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personality. Such a preference is called “Kuchiguse” an
The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called "Kuchiguse" and is often exaggerated art
一眼二分。 注意点: 在读入n之后要使用getchar接收后面的换行符,否则会使for循环内的getline读入这个换行符,导致第一个字符串读取错误。 最后输出答案前要先check一遍 const int N=110; string a[N]; string suffix; int n; bool check(int mid) { suffix=a[0].substr(a[0].s
题目 题意:给定n个字符串,求他们的最长公共后缀。 #include<iostream> using namespace std; int main() { int n; cin>>n; getchar(); string ans=""; getline(cin,ans); for(int i=1; i<n; ++i) { string b; getline(cin,b); string temp="";
题目大意:找出N个字符串的最长公共后缀。 输入第2 ~ N个字符串时,每次将输入的字符串与上一次得到的公共后缀比较即可,这里先将字符串反转处理起来比较方便。比较之后得到新的公共后缀。 AC代码: #include <iostream> #include <algorithm> #include <cstdio> using
1077 Kuchiguse (20 分) The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called "Kuchiguse"
The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called "Kuchiguse" and is often exaggerated art
1077 Kuchiguse (20 分) The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called "Kuchiguse" and
题目 The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personality. Such a preference is called “Kuchiguse” and is often exaggerated artistical