Submission #1434301
Source Code Expand
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
int i;
FOR(i,0,b) a[i]=c;
return;
}
char s[101],t[101];
int main(void)
{
int n,flag,i,j;
scanf("%d",&n);
scanf("%s",s);
scanf("%s",t);
FOR(i,0,n+1){
flag=1;
FOR(j,i,n){
if(s[j]!=t[j-i]){
flag=0;
break;
}
}
if(flag){
printf("%d\n",n+i);
return 0;
}
}
return 0;
}
Submission Info
Submission Time
2017-07-17 09:00:55+0900
Task
A - Prefix and Suffix
User
trainstation
Language
C (GCC 5.4.1)
Score
200
Code Size
763 Byte
Status
AC
Exec Time
1 ms
Memory
128 KB
Compile Error
./Main.c: In function ‘main’:
./Main.c:24:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.c:25:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",s);
^
./Main.c:26:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",t);
^
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
1 ms
128 KB
0_01.txt
AC
1 ms
128 KB
0_02.txt
AC
1 ms
128 KB
1_00.txt
AC
1 ms
128 KB
1_01.txt
AC
1 ms
128 KB
1_02.txt
AC
1 ms
128 KB
1_03.txt
AC
1 ms
128 KB
1_04.txt
AC
1 ms
128 KB
1_05.txt
AC
0 ms
128 KB