【Luogu3926】SAC E#1 - 一道不可做题 Jelly
【摘要】
problem
solution
codes
//巧妙的利用了x-=min(x,t); x若剩余为0则下面升温也为0
#include<iostream>
#include<alg...
problem
solution
codes
//巧妙的利用了x-=min(x,t); x若剩余为0则下面升温也为0
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
int main(){
LL a, c, p, q, r, x, t;
cin>>a>>c>>p>>q>>r>>x;
if(a < c){ //温度小于c,需要加热到解冻温度
t = min(x, p*(c-a)); //1.(t=x)加热不到c,那么x=0,r不需要加,a+=t/p即可
x -= t; //2.(t=p*(c-c)) 加热到了c, 此时a==c, x=x-t,也就是剩下的时间
a += t/p; //更新a的值为加热的时间除以解冻以前每秒升高的温度
}
if(a == c){ //温度达到了解冻温度
x -= min(x, q); //解冻需要的时间(若是不够解冻,则x==0,a值不变
}
a += x/r; //a要加上剩余的时间除以解冻以后每秒升高的温度;
cout<<a<<"\n";
return 0;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
文章来源: gwj1314.blog.csdn.net,作者:小哈里,版权归原作者所有,如需转载,请联系作者。
原文链接:gwj1314.blog.csdn.net/article/details/80573638
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)