Submission #1433189
Source Code Expand
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String s = sc.next(); String t = sc.next(); int index = 200; for(int i = 0; i < N; i++) { String sub = s.substring(i); String sub2 = t.substring(0, N - i); if(sub.equals(sub2)) { index = i; break; } } if(index == 200) index = N; System.out.println(N + index); } }
Submission Info
Submission Time | |
---|---|
Task | A - Prefix and Suffix |
User | takeya |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 504 Byte |
Status | AC |
Exec Time | 113 ms |
Memory | 22736 KB |
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 | 95 ms | 19284 KB |
0_01.txt | AC | 93 ms | 20692 KB |
0_02.txt | AC | 94 ms | 18516 KB |
1_00.txt | AC | 92 ms | 20692 KB |
1_01.txt | AC | 94 ms | 21716 KB |
1_02.txt | AC | 113 ms | 21332 KB |
1_03.txt | AC | 92 ms | 22736 KB |
1_04.txt | AC | 99 ms | 19412 KB |
1_05.txt | AC | 95 ms | 20560 KB |