大神们帮帮忙program received signal sigsegv
问题是这样的
The input consists of several data sets.Each set
begins with a line containing the number n of stacks Bob has built.The next
line contains n numbers,the heights hi of the n stacks.You may assume 1≤n≤50
and 1≤hi≤100.
The total number of bricks will be divisible by the number
of stacks.Thus,it is always possible to rearrange the bricks such that all
stacks have the same height.
The input is terminated by a set starting
with n = 0.This set should not be processed.
Output
For each set,print the minimum number
of bricks that have to be moved in order to make all the stacks the same
height.
Output a blank line between each set.
以下是我的程序
#include
#include
int main()
{
int a,b,c,n,d[100],i,j,sum=0,aver=0,sum1;
for (i=0;i
人气:305 ℃ 时间:2020-06-05 19:36:32
解答
第六行的scanf写的不对,应该是"%d"你怎么写成"&d"了.谢谢大神 对了 还有个问题 改过来以后我运行完结果一跳出来那个对话框就关闭了 我根本看不清结果 大神能不能帮忙看一下对话框一闪而过是因为你的程序执行完了。可以在return 0前面加一行
getchar();
这样前面的程序执行完后你要按一下回车才能结束。
推荐
猜你喜欢