Tyvj 1921 Freda的烦恼
生活随笔
收集整理的這篇文章主要介紹了
Tyvj 1921 Freda的烦恼
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
我就不說是CF hot days 原題了,我會告訴你使用Math庫是因為一開始偷懶不想寫Min函數(shù)么- ?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<>0)?do
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)=0)?then?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.-
?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<>0)?do
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)=0)?then?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.-
轉(zhuǎn)載于:https://www.cnblogs.com/shy-/archive/2012/09/11/2680757.html
總結
以上是生活随笔為你收集整理的Tyvj 1921 Freda的烦恼的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: commons-io之FileUtils
- 下一篇: Server.Transfer方法在页面