NYOJ 179 LK's problem
来源:互联网 发布:网络侵犯肖像权案例 编辑:程序博客网 时间:2024/06/06 21:39
LK's problem
时间限制:3000 ms | 内存限制:65535 KB
难度:1
- 描述
- 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. Ateller 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.
- 样例输入
21 21 10110 50 500
- 样例输出
2160
思路:略。
#include <stdio.h>#include <stdlib.h>int comp ( const void *a, const void *b ){ return * ( int * ) a - * ( int * ) b;}int main(){int n;while(scanf("%d",&n) != EOF && n){int i,c,t,a[110];int max = -1,j = 0,p = 1;for(i=0;i<n;i++){scanf("%d",&a[i]);}qsort(a,n,sizeof(int),comp);scanf("%d%d",&c,&t);for(i=n-1;i>=0;i--){if(j==c){p++;j=0;}j++;if (max < a[i]+p*t){max = a[i]+p*t;}}printf("%d\n",max); }return 0;}
0 0
- NYOJ 179 LK's problem
- NYOJ 179 LK's problem
- NYOJ 179 LK's problem ......
- NYOJ 179题 LK's problem
- NYOJ 179 LK's problem【贪心】
- NYOJ 179-LK's problem【模拟】
- NYOJ 179 LK‘problem
- NYOJ 179 LK's problem (排序模拟)
- LK's problem 05
- 179.LK's problem
- nyoj 291-LK的数学题
- NYOJ 291 LK的数学题
- nyoj-291-LK的数学题
- LK ARM64 start.S处理
- LK ARM64 asm.S处理
- LK源码解析 1 crt0.s
- LK源码解析 8 exceptions.S
- LK
- 应用 openssl 工具进行 SSL 故障分析
- 六种订单类型
- 燃一束暖暖的烛光,许个愿吧
- 使用XHProf进行性能测试
- Javascript模块化编程(二):AMD规范
- NYOJ 179 LK's problem
- SQL中ON和WHERE条件的区别
- 隐藏bat在后台运行
- Jackson 入门
- js 下拉底部加载|滑轮滚动到页面底部ajax加载数据的实例
- 配置 Redhat6 yum 更新源
- mysql 安装高版本后,导致无法grant 新的帐号的问题
- js动态显示当前年月日星期几时分秒
- Android cocos2d-x开发(二)之create-android-project.bat文件的修改