CSES - Datatähti 2016 alku - Results
Submission details
Task:Osajono
Sender:niklaskoskinen
Submission time:2015-09-30 15:50:19 +0300
Language:Java
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.20 s1details
#20.19 s1details
#30.19 s1details
#40.20 s1details
#50.19 s1details
#60.21 s2details
#70.21 s2details
#80.21 s2details
#90.22 s2details
#100.21 s2details
#110.26 s3details
#120.28 s3details
#130.25 s3details
#140.26 s3details
#150.26 s3details

Code

import java.util.Scanner;
public class Test {
    public static void main(String[] args) {
        System.out.println("String: ");
        Scanner inp = new Scanner(System.in);
        String test = inp.nextLine();
        long startt = System.nanoTime();
        int[] num;
        num = new int[26];
        test = test.toUpperCase();
        char[] testa = test.toCharArray();
        for(char t : testa){
            int cnum = (int) t;
            int ccnum = cnum - 65;
            num[ccnum] = num[ccnum] + 1;            
        }
        int ans = 0;
        int ansn = 0;
        for(int n : num){
            ans = ans + ((n * (n + 1))/2);
            ansn = ansn + n;
        }
        long stopt = System.nanoTime();
        long time = (stopt - startt);
        System.out.println(ans);
        
        
        }
    }

Test details

Test 1

Group: 1

Verdict:

input
BBBAABBBAAAABBAAAABAABAABBBBBB...

correct output
2554

user output
String: 
2554

Test 2

Group: 1

Verdict:

input
GDFVYWQCZAFGICSXOSWBZMGPDBSSVL...

correct output
299

user output
String: 
299

Test 3

Group: 1

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAZAAAA...

correct output
4314

user output
String: 
4314

Test 4

Group: 1

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4231

user output
String: 
4231

Test 5

Group: 1

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5050

user output
String: 
5050

Test 6

Group: 2

Verdict:

input
BBABABBBABBAABBABBABAABAAABABA...

correct output
6253029

user output
String: 
6253029

Test 7

Group: 2

Verdict:

input
RBKJMLDVQMKHYKCNDIVVKOMFUXTFMG...

correct output
485173

user output
String: 
485173

Test 8

Group: 2

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12427725

user output
String: 
12427725

Test 9

Group: 2

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12467549

user output
String: 
12467549

Test 10

Group: 2

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
12502500

user output
String: 
12502500

Test 11

Group: 3

Verdict:

input
BAAAAABABBABAABAABABABBBABBAAB...

correct output
2500051369

user output
String: 
-1794915927

Test 12

Group: 3

Verdict:

input
ABBURXDRVXAYBPXXOQZNYHLWGUEEWR...

correct output
192407124

user output
String: 
192407124

Test 13

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998050400

user output
String: 
703083104

Test 14

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998850144

user output
String: 
703882848

Test 15

Group: 3

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5000050000

user output
String: 
705082704