Submission #955631
Source Code Expand
#include<stdio.h>
#include<iostream>
#include<algorithm>
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i++)
using namespace::std;
int main(){
int n,ans;
char s[200],t[200];
cin>>n>>s>>t;
REP(i,n){
int j=0,f=0;
if(s[i]==t[j])REP(k,n-i){
if(s[i+k]!=t[k]){
f=0;
break;
}
f=1;
}
if(f==1){
printf("%d\n",n+i);
return 0;
}
}
printf("%d\n",n*2);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Prefix and Suffix |
| User | AtThatTime |
| Language | C++14 (GCC 5.4.1) |
| Score | 200 |
| Code Size | 457 Byte |
| Status | AC |
| Exec Time | 3 ms |
| Memory | 256 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 0_00.txt, 0_01.txt, 0_02.txt |
| All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 0_00.txt | AC | 3 ms | 256 KiB |
| 0_01.txt | AC | 3 ms | 256 KiB |
| 0_02.txt | AC | 3 ms | 256 KiB |
| 1_00.txt | AC | 3 ms | 256 KiB |
| 1_01.txt | AC | 3 ms | 256 KiB |
| 1_02.txt | AC | 3 ms | 256 KiB |
| 1_03.txt | AC | 3 ms | 256 KiB |
| 1_04.txt | AC | 3 ms | 256 KiB |
| 1_05.txt | AC | 3 ms | 256 KiB |