#105 Div2 B

方針

  • 問題 -> Escape
  • シミュレーション

コード

/*! g++ escape.cpp
 */

#include <iostream>

using namespace std;


class CheckEscape{
public:
  double vp, vd, t, f, c;
  int n_bijou;
  double p_pos;
  CheckEscape(int vp_, int vd_, int t_, int f_, int c_){
    vp = vp_;
    vd = vd_;
    t = t_;
    f = f_;
    c = c_;
  }
  int check(){
    n_bijou = 0;
    p_pos = t * vp;
    while(true){
      dragon_start();
      if(p_pos >= c) break;
      n_bijou++;
      dragon_back();
      dragon_wait();
    }
    return n_bijou;
  }
  void dragon_start(){
    double until_reach = p_pos / (vd - vp);
    p_pos += until_reach * vp;
  }
  void dragon_back(){
    double until_back = p_pos / vd;
    p_pos += until_back * vp;
  }
  void dragon_wait(){
    p_pos += f * vp;
  }

};

int main(int argc, char *argv[]){
  int vp, vd, t, f, c;
  cin >> vp >> vd >> t >> f >> c;
  if(vd <= vp){
    cout << 0 << endl;
    return 0;
  }
  CheckEscape check(vp, vd, t, f, c);
  cout << check.check() << endl;
  return 0;
}