1 条题解
-
0
C++ :
#include<bits/stdc++.h> #define N 1001 using namespace std; int main() { int n; string str; map<string,bool> m; cin>>n; for(int i=1;i<=n;i++) { cin>>str; m[str]=1; } int ans=0; map<string,bool>::iterator it; for(it=m.begin();it!=m.end();it++) { str.clear(); for(int i=0;i<it->first.size();i++) { str+=it->first[i]; if(!m[str]) m[str]=1; else { if(i==(it->first.size()-1)) continue; ans=max(ans,i+1); } } } printf("%d\n",ans); return 0; }
- 1
信息
- ID
- 1819
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者