用户ID: 密码: 验证:

登 录

注 册 取回密码

中山教育

中山国际网

中国教育在线

时代财富科技公司 FortuneAge Technology Co., Ltd. 校园博客客服网站(新)

我的资料

Mpq

博客信息

积分:988
等级:4级 lv 4
日志总数:231
发表评论总数:18 ( 查看)
获得评论总数:21
发表留言总数:0
所属学校:三鑫
收藏本站:

最新公告

欢迎光临我的博客!

最新相册

我的日历

最新评论

--游客
好文好文,是您的手笔?如果是您的文章,如果您愿意和我联系,...
还有就是数学不能使用计算器…….......在读初中之前原...
--Mpq
这次似乎不举行冬季长跑……看来在三鑫参加的体育项目最终是以...
--Mpq
看了你的"总结", 挺有针对性的! 相信下学期你一定会有...

RSS


首页 -> Zoj题库->Mining
Mining

Mining

Time limit: 1 Seconds   Memory limit: 32768K  
Total Submit: 1459   Accepted Submit: 241  

  A mining base needs to build some robots to collect at least 10000 units of resource. Each robot will start from the base, reach the diggings in S minutes, work for W minutes, and then take C units of resource back to the base in S minutes.
  To speed up this procedure, K robots will be built at the base. It takes M minutes to produce one robot. A robot will be set to start working immediately after it is built, and producing the next robot will be on line right after. This procedure continues untill all the robots are built.
  Due to the limitation of the mining equipments, there can be only one robot digging at the working area. That is, it is only after the currently working robot finishes its collecting work and starts getting back to the base that the next robot can work at the diggings.
  Now it is your job to write a program to simulate this procedure, and find out how many minutes it will take to collect at least 10000 units of resource.

Input
There are several lines of input. Each line contains a test case which consists of 5 integers, namely S, W, C, K, and M.

Output
For each test case, you are asked to output an integer t, which is the number of minutes taken to collect at least 10000 units of resource.

Sample Input:
10 20 10 1 5

Sample Output:
40005
 
Program Zoj_1200_Mpq;
Const Maxn=10000;
var
  s,w,c,m,Len,Ans:Longint;
  Heap:array[0..Maxn] of longint;
procedure init;
var
  i:integer;
begin
  Ans:=0;
  readln(s,w,c,Len,m);
  if 9999 div c+1<Len then Len:=9999 div c+1;
  for i:=1 to Len do
    Heap[i]:=i*m+s;
end;
procedure solve;
var
  i,j:integer;
begin
  if heap[1]>ans then ans:=heap[1];
  ans:=ans+w;
  inc(heap[1],2*s+w);
  i:=1; j:=i*2;
  while j<=Len do
  begin
    if (j<len) and (heap[j+1]<heap[j]) then inc(j);
    if heap[i]>heap[j] then
    begin
      heap[0]:=heap[i];
      heap[i]:=heap[j];
      heap[j]:=heap[0];
      i:=j;
      j:=j*2;
    end else break;
  end;
end;
procedure work;
var
  i:integer;
begin
  for i:=1 to 9999 div c+1 do solve;
  writeln(ans+s);
end;
begin
  while not eof do
  begin
    init;
    work;
  end;
end.

网友评论

共 0 页,0 条记录  

用户名:
密码:
您的评论:
正在载入编辑器...
请输入验证码:


发 表 评 论

Mpq-中山教师家园