Skip to content

Instantly share code, notes, and snippets.

@vikhyat
Created December 10, 2014 05:00
Show Gist options
  • Save vikhyat/835d547fdda1a800ca1a to your computer and use it in GitHub Desktop.
Save vikhyat/835d547fdda1a800ca1a to your computer and use it in GitHub Desktop.
#define eq(X, a) ((X[0] == a[0]) && (X[1] == a[1]))
main() {
int t;
float tp, tn, fp, fn, p, r;
tp = tn = fp = fn = 0;
char c[3];
scanf("%d\n", &t);
while (t--) {
gets(c);
if (eq(c, "++")) tp++;
if (eq(c, "+-")) fn++;
if (eq(c, "-+")) fp++;
if (eq(c, "--")) tn++;
}
p = tp / (tp + fp);
r = tp / (tp + fn);
printf("%.2f", 2*p*r / (p+r));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment