| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 776 人关注过本帖
标题:求指点??????????????????????
取消只看楼主 加入收藏
天天涯涯
Rank: 4
等 级:业余侠客
帖 子:215
专家分:267
注 册:2011-10-17
结帖率:94.74%
收藏
已结贴  问题点数:10 回复次数:5 
求指点??????????????????????
程序代码:
#include
double del(double a[],double time,int n)
{
  double minimum;
  int i,j;
  minimum=a[0]+n*time;
  for(i=1;i<N;I++)
    if(minimum<=a[i]+(n-i)*time)
      minimum=a[i]+(n-i)*time;
  return minimum;
}
int main()
{
  int i,n,j,count=0;
  double c[100],a[100],temp,b[2];
  scanf("%d",&n);
  while(n)
  {
     for(i=0;i<N;I++)
       scanf("%lf",&a[i]);
     for(i=0;i<2;i++)
       scanf("%lf",&b[i]);
     for(i=0;i<N;I++)
       for(j=0;j<N-1-I;J++)
      if(a[j]>=a[j+1])
      {
        temp=a[j];
        a[j]=a[j+1];
        a[j+1]=temp;
      }
     c[count]=del(a,b[1],n);
     count++;
     scanf("%d",&n);
  }
  for(i=0;i<COUNT;I++)
    printf("%g\n",c[i]);
  return 0;
}
LK has a question.Coule you help her?
It is the beginning of the day at a bank, and a crowd  of clients is already waiting for the entrance door to  open.
Once the bank opens, no more clients arrive, and  tellerCount tellers begin serving the clients. A  
teller takes serviceTime minutes to serve each client.  clientArrivals specifies how long each client has  already been waiting at the moment when the bank door  opens. Your program should determine the best way to arrange the clients into tellerCount queues, so that  the waiting time of the client who waits longest is minimized. The waiting time of a client is the sum of  the time the client waited outside before the bank opened, the time the client waited in a queue once the  bank opened until the service began, and the service time of the client. Return the minimum waiting time for the client who waits the longest.
输入
The input will consist of several test cases. For each test case, one integer N (1<= N <= 100) is given in the first line. Second line contains N integers telling us the time each client had waited.Third line contains tow integers , teller's count and service time per client need. The input is terminated by a single line with N = 0.
输出
For each test of the input, print the answer.
样例输入
2
1 2
1 10
1
10
50 50
0
************
上面代码的思路有没有错误???给点意见。。
搜索更多相关主题的帖子: minimum 
2011-12-17 13:44
天天涯涯
Rank: 4
等 级:业余侠客
帖 子:215
专家分:267
注 册:2011-10-17
收藏
得分:0 
谁有测试数据给点
2011-12-17 14:47
天天涯涯
Rank: 4
等 级:业余侠客
帖 子:215
专家分:267
注 册:2011-10-17
收藏
得分:0 
大小写没有问题,粘贴的时候出问题了。
2011-12-17 18:55
天天涯涯
Rank: 4
等 级:业余侠客
帖 子:215
专家分:267
注 册:2011-10-17
收藏
得分:0 
思路是先把数据从小到大排序,遵循先来后到的原则,计算每个人从来到走所用的时间。
2011-12-17 18:59
天天涯涯
Rank: 4
等 级:业余侠客
帖 子:215
专家分:267
注 册:2011-10-17
收藏
得分:0 
回复 6楼 czz5242199
结果是21   60,能不能你把你的思路再说清楚一点。
2011-12-17 19:43
天天涯涯
Rank: 4
等 级:业余侠客
帖 子:215
专家分:267
注 册:2011-10-17
收藏
得分:0 
主要是对你的那个m不太理解,也就是第三行数据的第一个数(teller's count )什么意思
2011-12-17 22:27
快速回复:求指点??????????????????????
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013448 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved