我坚持使用一个程序,只是有一个printf语句导致输出的变化.
我有一系列n元素.对于median每个d连续元素,如果(d+1)th element大于或等于它的两倍(中位数),我正在递增值notifications.完整的问题陈述可能会在这里提及.
这是我的计划:
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
#define RANGE 200
float find_median(int *freq, int *ar, int i, int d) {
int *count = (int *)calloc(sizeof(int), RANGE + 1);
for (int j = 0; j <= RANGE; j++) {
count[j] = freq[j];
}
for (int j = 1; j <= RANGE; j++) {
count[j] += count[j …Run Code Online (Sandbox Code Playgroud)