跳到正文

个人记录

222

jy_ua约 1 分钟
原文
文章信息与版本

文章信息

收录
2026年2月8日
更新
2026年2月12日
篇幅
约 1 分钟

版本

  1. v4当前
  2. v3
  3. v2
  4. v1
C++
#include <bits/stdc++.h>
using namespace std;
int n,k;
string s[505],str[505];
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>s[i];
	for(int i=1;i<=n-k+1;i++){
		for(int j=1;j<=n;j++){
			str[j]=s[j];
			sort(str[j].begin()+i-1,str[j].begin()+i+k-1);
		}
		for(int j=1;j<=n;j++)
			for(int l=j+1;l<=n;l++)
				if(str[j]==str[l]) return (cout<<"DA",0);
	}
	cout<<"NE";
	return 0;
}
原文