C语言编程题求助
#include
voidmain()
intsum_people;
intsum_floor[100]={0};
intmove_people;
intstop_floor=0;
inttemp;
intmax_floor=0;
inti;
inttime=0;
scanf("%d",&sum_people);
while(sum_people>0)
printf("pleaseenterthestopfloor:");
scanf("%d",&stop_floor);
if(stop_floor>max_floor)
max_floor=stop_floor;
printf("pleaseenterthepeople:");
scanf("%d",&temp);
if(temp>sum_people)
printf("thereis%dpeopleatmore!");
getch();
return;
sum_floor[stop_floor-1]+=temp;
sum_people-=temp;
for(i=0;i
if(sum_floor[i]!=0)
time+=5;
time=time+max_floor*(6+4);
printf("alltimeis=%d\n",time);
getch();
相信你能看懂我的代码~
你把关键问题直接放输入里了
关键问题是10个人,分别去5,5,5,5,10,10,10,10,10,10
输入这些数字后怎么在程序中判断5楼有4个,10楼有6个
你给的样例多不好了
42222输出样例
我以为是4人,2楼2个,2楼2个~
那我改一下吧
#include
voidmain()
intsum_people;
intsum_floor[100]={0};
intmove_people;
intstop_floor=0;
inttemp;
intmax_floor=0;
inti;
inttime=0;
scanf("%d",&sum_people);
while(sum_people>0)
scanf("%d",&stop_floor);
if(stop_floor>max_floor)
max_floor=stop_floor;
sum_floor[stop_floor-1]++;
sum_people--;
for(i=0;i
if(sum_floor[i]!=0)
time+=5;
time=time+max_floor*(6+4);
printf("alltimeis=%d\n",time);
getch();
C语言编程题求助!急!有n行m列的矩形框,填入数字1,2,3...n*m,每个数字只能使用1次?
求助编程小问题
求助一个编程的问题
c++中的setw(n)是设置域宽。 就是你的输出要占多少个字符比如,int a=80,b=8000, ?cout<