/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 324.0 KiB
#2 Wrong Answer 10ms 5.023 MiB
#3 Wrong Answer 10ms 5.066 MiB

Code

#include <stdio.h>

int main()
{
    int t;
    scanf("%d", &t);
    while (t--)
    {
        int a;
        scanf("%d", &a);
        char str[a + 1];
        scanf("%s", str);
        int check[a + 1];
        for (int i = 0; str[i] != '\0'; i++)
        {
            check[i] = 0;
            check[str[i] - 'a'] = 1;
        }
        int count = 0;
        for (int i = 0; i < a + 1; i++)
        {
            if (check[i] == 1)
            {
                count++;
            }
        }
        if (a == 1)
        {
            printf("0\n");
        }
        else
        {
            printf("%d\n", count * 2);
        }
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1038 Do not touch my string
Contest
Brain Booster #3
Language
C99 (GCC 13.2.0)
Submit At
2024-05-06 15:51:37
Judged At
2024-11-11 03:33:47
Judged By
Score
10
Total Time
10ms
Peak Memory
5.066 MiB