QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#102459 | #5666. Repetitive Elements | flashtomato# | AC ✓ | 3ms | 3436kb | C++14 | 1.1kb | 2023-05-03 13:32:22 | 2023-05-03 13:32:24 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+10;
ll t;
string str;
int main (void)
{
cin>>t;
while (t--)
{
cin>>str;
ll Len=str.size();
ll Ans_Len=Len/2;
for(ll i=Ans_Len;i>=1;i--)// 这个是长度
{
// 枚举一下开头
bool success=false;
for(ll j=0;j<=(Len-i);j++)
{
string Ans_Str=str.substr(j,i);
string Find_Ans_str=str.substr(j+i);
ll idx=Find_Ans_str.find(Ans_Str);
// cout<<Ans_Str<<" "<<Find_Ans_str<<" "<<i<<" "<<idx<<endl;
if(idx!=string::npos)
{
cout<<Ans_Str<<endl;
success= true;
break;
}
}
if(success)
break;
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3432kb
input:
5 TATCGATCGAGTTGT TCCGCGAGCGAGTCTCTCCATT GTTTCATCATACGAGGCCCCATACGCGCTGG AGATGGGATCCTTATG GCCCTTAGGCATGGGATGTCGTTTCTTG
output:
ATCG GCGA CATACG GAT CTT
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 3ms
memory: 3436kb
input:
50 TTGACAACTTCAGGTTGGCACTCCTTCATTTGGATTTCGGAATAATAGTTTTCTGCTCTGCC ATCCTATTCGGGGATAGGAGAGATGGGTTGCCGCTATAAAAGCATTTGAACTCCATTTCACTCCGTTGGCTAGGGGTCGCACTG CCGTAATATAAAGACTCGGAATTCCAATAGCTGCTATTTGCGAGTATGTGACTGAAAACACACCTATAAATATTAGCTGCGTACAAGCTA ATGGCTGCATGCAGGGTCGACTAGACACACTTTGTCT TTGAGGATGTCGACGTGTCT...
output:
CTTCA CATTT TAGCTGC TGCA ACGTG GCGCCGG CTCTT AGTAT AGAG ACAG TAT TGAC CTTG CGTC TACTGG GCCGGT GAA CAGTA GCGT GGTT CCCT GAG TAGAC GGTGC GCAGT TGAG ATCAA CCACACA GAGTC ATGTA ATGGTA TATA TATGAA TTCC CATACG TACCA TTAG GGAATGT CAGG GCT AAG CTGT GGAT TCTTC AAAAC ATG GATAA TTA ACATAT CAAT
result:
ok 50 lines