Submission #1350295
Source Code Expand
import java.util.Scanner; public class Main { static Scanner in = new Scanner(System.in); public static void main(String[] args) { int n = Integer.parseInt(in.nextLine()); String s = in.nextLine(), t = in.nextLine(); int max = 0; for(int i = 0; i < n; i++){ String ts = s.substring(s.length() - 1 - i, s.length()); String tt = t.substring(0, i + 1); if(ts.equals(tt)){ max = i + 1; } } System.out.println(n * 2 - max); } }
Submission Info
Submission Time | |
---|---|
Task | A - Prefix and Suffix |
User | mosmos21 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 477 Byte |
Status | AC |
Exec Time | 98 ms |
Memory | 23124 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 | 90 ms | 21332 KB |
0_01.txt | AC | 90 ms | 21716 KB |
0_02.txt | AC | 98 ms | 21716 KB |
1_00.txt | AC | 91 ms | 21972 KB |
1_01.txt | AC | 91 ms | 21460 KB |
1_02.txt | AC | 91 ms | 21716 KB |
1_03.txt | AC | 94 ms | 21588 KB |
1_04.txt | AC | 91 ms | 20564 KB |
1_05.txt | AC | 92 ms | 23124 KB |