Task: | Sanalista |
Sender: | anton7r |
Submission time: | 2020-10-09 21:35:11 +0300 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.08 s | details |
#2 | RUNTIME ERROR | 0.08 s | details |
#3 | RUNTIME ERROR | 0.08 s | details |
Code
import java.util.HashMap; import java.util.Map; public class Main { public static void main(String[] args) { int rivienMaara; String merkkijono; int pituus; int parilliset = 0; rivienMaara = Integer.parseInt(args[0]); for (int i = 1; i < rivienMaara; i++) { merkkijono = args[i].trim(); pituus = merkkijono.length(); if(pituus % 2 == 0) { Map<Character, Integer> merkkienMaarat = new HashMap<>(); for (int j = 0; j < pituus; j++) { final char merkki = merkkijono.charAt(j); Integer merkinMaara = merkkienMaarat.get(merkki); if(merkinMaara == null) { merkinMaara = 0; } merkkienMaarat.put(merkki, merkinMaara + 1); } for (Character k : merkkienMaarat.keySet()) { if(merkkienMaarat.get(k) % 2 != 0) { break; } } parilliset++; } } System.out.println(parilliset); } }
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
1000 korvata sopimusaika nuhatartunta korttiautomaatti ... |
correct output |
---|
15 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds...
Test 2
Verdict: RUNTIME ERROR
input |
---|
1000 pub hansikaslokero erikoisvalmisteinen unijukka ... |
correct output |
---|
42 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds...
Test 3
Verdict: RUNTIME ERROR
input |
---|
1000 haapalastu toipumisaika mustalaiskieli taidelainaamo ... |
correct output |
---|
70 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds...