int main(void) { int i; char name1[MAXLEN + 1]; char name2[MAXLEN + 1]; char action[MAXLEN + 1]; int value; while (scanf("%s %*s %s %d %*s %*s %*s %*s %*s %*s %s", name1, action, &value, name2) != EOF) { name2[strlen(name2) - 1] = '\0'; if (!strcmp(action, "lose")) value = -value; int index1 = get_index_for(name1); int index2 = get_index_for(name2); guests[index1][index2] = value; } calculate_happiness_difference(0); printf("%d\n", max_happiness); return 0; }
void ndim_histogram_increment(ndim_histogram * h, gsl_vector * current) { h->values[get_index_for(h, current)]++; }