Submission #51333741
Source Code Expand
Copy
import java.util.HashSet;import java.util.Scanner;import java.util.Set;public class Main {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);String inputStr = scanner.nextLine();Set<String> set = new HashSet<>();for(int i=0;i<inputStr.length();i++){for(int j=i+1;j<inputStr.length();j++){StringBuilder sb = new StringBuilder(inputStr);char a = inputStr.charAt(i);char b = inputStr.charAt(j);sb.setCharAt(i, b);sb.setCharAt(j, a);set.add(sb.toString());}
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String inputStr = scanner.nextLine(); Set<String> set = new HashSet<>(); for(int i=0;i<inputStr.length();i++){ for(int j=i+1;j<inputStr.length();j++){ StringBuilder sb = new StringBuilder(inputStr); char a = inputStr.charAt(i); char b = inputStr.charAt(j); sb.setCharAt(i, b); sb.setCharAt(j, a); set.add(sb.toString()); } } System.out.println(set.size()); } }
Submission Info
Submission Time | |
---|---|
Task | C - One Time Swap |
User | Izukiuchiha |
Language | Java (OpenJDK 17) |
Score | 0 |
Code Size | 765 Byte |
Status | RE |
Exec Time | 2210 ms |
Memory | 989264 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 350 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_00.txt, example_01.txt |
All | example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_00.txt | AC | 71 ms | 38192 KB |
example_01.txt | AC | 67 ms | 37704 KB |
hand_00.txt | TLE | 2210 ms | 61588 KB |
hand_01.txt | AC | 67 ms | 37880 KB |
hand_02.txt | AC | 68 ms | 38188 KB |
hand_03.txt | AC | 70 ms | 38072 KB |
hand_04.txt | AC | 71 ms | 37904 KB |
hand_05.txt | RE | 2103 ms | 989104 KB |
hand_06.txt | TLE | 2210 ms | 61316 KB |
random_00.txt | AC | 67 ms | 37788 KB |
random_01.txt | AC | 68 ms | 38040 KB |
random_02.txt | AC | 69 ms | 38136 KB |
random_03.txt | AC | 68 ms | 37832 KB |
random_04.txt | AC | 69 ms | 37880 KB |
random_05.txt | RE | 2135 ms | 988380 KB |
random_06.txt | RE | 2117 ms | 988756 KB |
random_07.txt | RE | 2098 ms | 988988 KB |
random_08.txt | RE | 2111 ms | 989144 KB |
random_09.txt | RE | 2096 ms | 989264 KB |
random_10.txt | RE | 2103 ms | 988752 KB |
random_11.txt | RE | 2093 ms | 988464 KB |
random_12.txt | RE | 2100 ms | 989148 KB |
random_13.txt | RE | 2094 ms | 988636 KB |
random_14.txt | RE | 2106 ms | 988800 KB |