Submission #954373
Source Code Expand
#include<stdio.h> void input(int *N, char *s, char *t) { scanf("%d", N); scanf("%s", s); scanf("%s", t); } int str_slide_compare(char *str1, char *str2, int num) { for (int i = 0; i < num; i++){ if(str1[i] != str2[i]){ return 0; } } return 1; } int main(void) { char s[101]; char t[101]; int N; input(&N, s, t); int slide; for (slide = 0; slide <= 100; slide++){ if (str_slide_compare(s + slide, t, N - slide)) { break; } } printf("%d\n",slide+N); }
Submission Info
Submission Time | |
---|---|
Task | A - Prefix and Suffix |
User | muctera |
Language | C (GCC 5.4.1) |
Score | 200 |
Code Size | 596 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘input’: ./Main.c:4:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", N); ^ ./Main.c:5:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", s); ^ ./Main.c:6:5: 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 | 1 ms | 128 KB |