Submission #1354342
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(); } } 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 | 0 |
Code Size | 903 Byte |
Status | WA |
Exec Time | 79 ms |
Memory | 21204 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 18388 KB |
0_01.txt | AC | 67 ms | 19540 KB |
0_02.txt | AC | 67 ms | 21204 KB |
1_00.txt | AC | 68 ms | 18900 KB |
1_01.txt | WA | 70 ms | 21204 KB |
1_02.txt | AC | 69 ms | 18644 KB |
1_03.txt | AC | 70 ms | 17620 KB |
1_04.txt | AC | 68 ms | 17748 KB |
1_05.txt | AC | 79 ms | 20692 KB |