博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hihocoder 1631
阅读量:4559 次
发布时间:2019-06-08

本文共 1923 字,大约阅读时间需要 6 分钟。

时间限制:1000ms
单点时限:1000ms
内存限制:256MB

描述

There are many homeless cats in PKU campus. They are all happy because the students in the cat club of PKU take good care of them. Li lei is one of the members of the cat club. He loves those cats very much. Last week, he won a scholarship and he wanted to share his pleasure with cats. So he bought some really tasty fish to feed them, and watched them eating with great pleasure. At the same time, he found an interesting question:

There are m fish and n cats, and it takes ci minutes for the ith cat to eat out one fish. A cat starts to eat another fish (if it can get one) immediately after it has finished one fish. A cat never shares its fish with other cats. When there are not enough fish left, the cat which eats quicker has higher priority to get a fish than the cat which eats slower. All cats start eating at the same time. Li Lei wanted to know, after x minutes, how many fish would be left.

输入

There are no more than 20 test cases.

For each test case:

The first line contains 3 integers: above mentioned m, n and x (0 < m <= 5000, 1 <= n <= 100, 0 <= x <= 1000).

The second line contains n integers c1,c2 … cn,  ci means that it takes the ith cat ci minutes to eat out a fish ( 1<= ci <= 2000).

输出

For each test case, print 2 integers p and q, meaning that there are p complete fish(whole fish) and q incomplete fish left after x minutes.

样例输入
2 1 118 3 51 3 44 5 15 4 3 2 1
样例输出
1 00 10 3 (最近刷题又陷入瓶颈,真是啥题都卡 附ac代码:
1 #include
2 #include
3 #include
4 #include
5 using namespace std; 6 const int maxn = 5005; 7 int nu[maxn]; 8 int cnt[maxn]; 9 int b[maxn];10 int main()11 {12 int m,n,x;13 while(~scanf("%d%d%d",&m,&n,&x))14 {15 memset(b,0,sizeof(b));16 for(int i=0;i
View Code

 

转载于:https://www.cnblogs.com/zmin/p/7860528.html

你可能感兴趣的文章
Liunx下的有关于tomcat的相关操作 && Liunx 常用指令
查看>>
PMP考试通过
查看>>
js声明 对象,数组 的方法
查看>>
Ftp服务配置
查看>>
【Spring】---属性注入
查看>>
搭建Hibernate环境
查看>>
【MyBatis】-----【MyBatis】---表级联系【一对多】
查看>>
MySQL 存储过程参数IN OUT INOUT区别
查看>>
2018.08.30 bzoj4720: [Noip2016]换教室(期望dp)
查看>>
2018.10.13 bzoj1070: [SCOI2007]修车(费用流)
查看>>
redis基本操作
查看>>
学习进度7
查看>>
暑期生活1
查看>>
xib或storyBoard中往scrollView添加子控件
查看>>
dataloader下载|data loader破解版下载v4.8
查看>>
linux环境c++开发:ubuntu12.04使用llvm3.4.2
查看>>
单元格颜色渐变的GridView
查看>>
高性能爬虫为什么使用定制DNS客户端?
查看>>
个人作业——软件工程实践总结作业
查看>>
两个有序数列的合并
查看>>