/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 0ms 320.0 KiB
#2 Wrong Answer 1ms 328.0 KiB

Code

#include <stdio.h>

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

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1055 Array Permutation
Language
C99 (GCC 13.2.0)
Submit At
2024-05-08 16:06:03
Judged At
2024-11-11 03:30:23
Judged By
Score
0
Total Time
1ms
Peak Memory
328.0 KiB