Tyvj 1921 Freda的烦恼

我就不说是CF hot days 原题了,我会告诉你使用Math库是因为一开始偷懒不想写Min函数么-
 1 Uses math;
 2 Var n,m,i,t,tt,x,cost,ans,tmp:qword;
 3 Function min(x,y:qword):qword;
 4 Begin
 5    if x>y  then exit(y);
 6   exit(x);
 7  end;
 8 Begin
 9    readln(n,m);
10     while (n<> 0do
11    Begin
12      dec(n);
13      readln(t,tt,x,cost);
14       if (tt<=t)  then
15       begin
16        ans:=ans+cost;
17        continue;
18       end;
19       if (m  mod (tt-t)= 0then tmp:=cost*trunc((m/(tt-t)))
20       else tmp:=cost*trunc((m/(tt-t)+ 1));
21      ans:=ans+min(m*x+cost,tmp);
22     end;
23    writeln(ans);
24  end.
-

转载于:https://www.cnblogs.com/shy-/archive/2012/09/11/2680757.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值