Time Exceeded
Code
#include <stdio.h>
int main(){
    int x = 0, t;
    scanf("%d", &t);
    while(x < t){
        int n;
        scanf("%d", &n);
        char p[n+10];
        scanf("%s", &p);
        int count = 0;
        if(n <= 1){
            count = 0;
        }
        else{
            for(int i = 0; i < n; i++){
                for (int j = 0; j < n; j++){
                    if(i == j){
                        continue;
                    }
                    if(p[i] == p[j]){
                        count++;
                    }
                }
            }
        }
        printf("%d\n", count);
        x++;
    }
    return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1038 E. Do not touch my string
- Contest
- Brain Booster #3
- Language
- C99 (GCC 13.2.0)
- Submit At
- 2024-05-06 16:49:59
- Judged At
- 2024-11-11 03:32:45
- Judged By
- Score
- 10
- Total Time
- ≥2093ms
- Peak Memory
- ≥1.316 MiB