![BiliBili, <wbr>ACFun… <wbr>And <wbr>More! BiliBili, <wbr>ACFun… <wbr>And <wbr>More!](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
![BiliBili, <wbr>ACFun… <wbr>And <wbr>More! BiliBili, <wbr>ACFun… <wbr>And <wbr>More!](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
没错我又睡不着来码代码来了(=゚ω゚)ノ
这次这个题真是一点开就吓尿啊,他喵的全是英文啊有木有
(╯`□′)╯┻━┻
算了,还是先上正文
算了,还是先上正文
C++语言:
高亮代码由发芽网提供
01
#include
02
03
using
namespace
std;
04
05
float
js(
float
X,
float
Y,
float
T,
float
S){
06
if
(X<=Y){
07
float
t=S/X;
08
return
t;
09
}
10
float
t0=S/Y;
11
float
t=T*Y/(X-Y);
12
float
t_temp1=
0;
13
float
t_temp2=
0;
14
while(t<(t0-T)){
15
t_temp1=t_temp2;
16
t_temp2=t;
17
t=t+(t+T)*Y/(X-Y);
18
}
19
t=t_temp2+S/X;
//本来是像下面这样写的
20
return
t;
31 }
32
33
int
main(){
34
int
N=
0;
35
float
X[
1000]={
0},Y[
1000]={
0},S[
1000]={
0},T[
1000]={
0};
36
int
i;
37
cin>>N;
38
for
(i=
0;i
39
cin>>X[i]>>Y[i]>>T[i]>>S[i];
40
}
41
for
(i=
0;i
42
printf(
"Case #%d: %.3f
\n
",i+
1,js(X[i],Y[i],T[i],S[i]));
43
}
44 }
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
![BiliBili, <wbr>ACFun… <wbr>And <wbr>More! BiliBili, <wbr>ACFun… <wbr>And <wbr>More!](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
31
32
33
34
35
36
37
38
39
40
41
42
43
44
这次用了差不多两个小时吧,读题就读了10多分钟啊妈蛋
(╯`□′)╯┻━┻
总的来说还是比较简单,嗯,就是这样
看球去喽~
PPS:新浪啥时候能添加一个插入代码的插件啊。。。