BiliBili, ACFun… And More!

BiliBili, <wbr>ACFun… <wbr>And <wbr>More!

BiliBili, <wbr>ACFun… <wbr>And <wbr>More!
没错我又睡不着来码代码来了(=゚ω゚)ノ
这次这个题真是一点开就吓尿啊,他喵的全是英文啊有木有 (╯`□′)╯┻━┻
算了,还是先上正文

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;
BiliBili, <wbr>ACFun… <wbr>And <wbr>More!
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 }

这次用了差不多两个小时吧,读题就读了10多分钟啊妈蛋 (╯`□′)╯┻━┻
总的来说还是比较简单,嗯,就是这样
看球去喽~

PS:第一次发表之后发现居然少了一截。。。所以 BiliBili, <wbr>ACFun… <wbr>And <wbr>More! 的内容会被注释掉是么。。。。。。
PPS:新浪啥时候能添加一个插入代码的插件啊。。。

你可能感兴趣的:(ACM)