質問

LinuxでCを書いている、親とN個の子供たちをフォークしています。親はSQRT(ARRAYSIZE)を取り、残りはN個の子供に等しく分かれています。

N個の子供たちに残りの部分を等しく分割することができますか?\

thnx :)

役に立ちましたか?

解決

int arraySize = 100; // You would get a count from the array here
int nChildren = 5; // This would be provided by you as a parameter to this function
int parentSize = sqrt(arraySize);
int remainder = arraySize - parentSize;
int nChildSize = (remainder / nChildren) + 1
.

他のヒント

あなたは完全な答えを与えるのに十分に私たちに言っていない

Decide size of share for each child, also determine what to do with any "remainder"

For each child 
    allocate an array sufficient to hold the required number of value
    populate the array
.

どのビットを停止していますか?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top