#include <ctype.h>
#include <string.h>
#include "grader.h"
#include "lang.h"
#define N 100
#define A 512
#define L 56
#define INF 1e9
double abs_(double a) { return a > 0 ? a : -a; }
double kk[L][A];
void excerpt(int *E) {
static double kk_[A];
int i, l, l_, l1, a, k;
double d_, d;
memset(kk_, 0, A * sizeof *kk_), k = 0;
for (i = 0; i < N; i++) {
if (isspace(E[i]))
continue;
kk_[E[i] / 128] += 1, k++;
}
if (k != 0)
for (a = 0; a < A; a++)
kk_[a] /= k;
l_ = -1, d_ = INF;
for (l = 0; l < L; l++) {
d = 0;
for (a = 0; a < A; a++)
d += abs_(kk_[a] - kk[l][a]);
if (d_ > d)
d_ = d, l_ = l;
}
l1 = language(l_);
for (a = 0; a < A; a++)
kk[l1][a] = kk_[a];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
478 ms |
5832 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
481 ms |
5716 KB |
Output is partially correct - 33.91% |