Submission #1354346
Source Code Expand
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { try { // 標準入力 InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); int n = Integer.parseInt(br.readLine()); String s = br.readLine(); String t = br.readLine(); int ans = n * 2; for (int i = 0; i < n; i++) { String tmp1 = s.substring(i); String tmp2 = t.substring(0, t.length() - i); if (tmp1.equals(tmp2)) { ans -= tmp1.length(); break; } } System.out.println(ans); } catch (IOException e) { e.printStackTrace(); } } }
Submission Info
Submission Time | |
---|---|
Task | A - Prefix and Suffix |
User | unirita17 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 931 Byte |
Status | AC |
Exec Time | 82 ms |
Memory | 21076 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 | 67 ms | 19156 KB |
0_01.txt | AC | 68 ms | 20052 KB |
0_02.txt | AC | 69 ms | 19156 KB |
1_00.txt | AC | 68 ms | 21076 KB |
1_01.txt | AC | 69 ms | 17108 KB |
1_02.txt | AC | 77 ms | 19540 KB |
1_03.txt | AC | 68 ms | 20564 KB |
1_04.txt | AC | 82 ms | 20052 KB |
1_05.txt | AC | 69 ms | 19156 KB |