Task: | Onnenluku |
Sender: | odporkka |
Submission time: | 2019-05-31 17:53:27 +0300 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.37 s | 1 | details |
#2 | WRONG ANSWER | 0.36 s | 1 | details |
#3 | WRONG ANSWER | 0.39 s | 1 | details |
#4 | WRONG ANSWER | 0.39 s | 1 | details |
#5 | WRONG ANSWER | 0.38 s | 1 | details |
#6 | WRONG ANSWER | 0.39 s | 2 | details |
#7 | WRONG ANSWER | 0.37 s | 2 | details |
#8 | WRONG ANSWER | 0.39 s | 2 | details |
#9 | WRONG ANSWER | 0.39 s | 2 | details |
#10 | WRONG ANSWER | 0.39 s | 2 | details |
#11 | WRONG ANSWER | 0.39 s | 3 | details |
#12 | WRONG ANSWER | 0.38 s | 3 | details |
#13 | WRONG ANSWER | 0.38 s | 3 | details |
#14 | WRONG ANSWER | 0.39 s | 3 | details |
#15 | WRONG ANSWER | 0.38 s | 3 | details |
Code
import java.util.HashSet; import java.util.Scanner; public class K19_2_5_Onnenluku { static String[] numbers = new String[72]; static HashSet<String> answers = new HashSet<>(); public static void main(String[] args) { int x = 0; for (int i = 12; i < 99; i++) { if (i % 10 != 0 && (i / 10 != i % 10)) { numbers[x] = i + ""; x++; } } // Scanner s = new Scanner(System.in); // String input = s.nextLine(); // s.close(); // String[] split = input.split("\\s+"); // solve(split[0], split[1]); solve("0", "10000"); System.out.println(answers.size()); } private static void solve(String min, String max) { for (int i = 0; i < numbers.length; i++) { String s = numbers[i]; recursion(s, min, max, s.charAt(0), s.charAt(1)); } } private static void recursion(String s, String min, String max, char a, char b) { if (Integer.parseInt(s) > Integer.parseInt(max)) return; if (Integer.parseInt(s) >= Integer.parseInt(min)) { answers.add(s); System.out.println(s); } if (s.length() == max.length()) { return; } recursion(s += a, min, max, a, b); s = s.substring(0, s.length() - 1); recursion(s = a + s, min, max, a, b); s = s.substring(1, s.length()); recursion(s += b, min, max, a, b); } }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
2157 93337 |
correct output |
---|
1421 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 2
Group: 1
Verdict: WRONG ANSWER
input |
---|
4875 95124 |
correct output |
---|
1278 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
5577 96352 |
correct output |
---|
1245 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
8362 92950 |
correct output |
---|
1076 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
5658 96660 |
correct output |
---|
1238 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 6
Group: 2
Verdict: WRONG ANSWER
input |
---|
51312303535233 994542403556353 |
correct output |
---|
1453976 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 7
Group: 2
Verdict: WRONG ANSWER
input |
---|
25636920452341 934558290712847 |
correct output |
---|
1544072 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 8
Group: 2
Verdict: WRONG ANSWER
input |
---|
7917952071965 985207415843573 |
correct output |
---|
1763176 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 9
Group: 2
Verdict: WRONG ANSWER
input |
---|
48991581181227 907034837225965 |
correct output |
---|
1380248 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 10
Group: 2
Verdict: WRONG ANSWER
input |
---|
47968703305149 924246001328437 |
correct output |
---|
1396632 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 11
Group: 3
Verdict: WRONG ANSWER
input |
---|
292953755324413237753216241025... |
correct output |
---|
53286731528535944 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 12
Group: 3
Verdict: WRONG ANSWER
input |
---|
373990979330820426927419348165... |
correct output |
---|
51580289482227600 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 13
Group: 3
Verdict: WRONG ANSWER
input |
---|
701417326319476057561825658890... |
correct output |
---|
42924933948374952 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 14
Group: 3
Verdict: WRONG ANSWER
input |
---|
177202883511434557056457305647... |
correct output |
---|
54500592365600640 |
user output |
---|
12 121 1211 1121 1212 ... |
Test 15
Group: 3
Verdict: WRONG ANSWER
input |
---|
977665117437419620152569155919... |
correct output |
---|
38562071809359800 |
user output |
---|
12 121 1211 1121 1212 ... |