結果

問題 No.813 ユキちゃんの冒険
ユーザー hashiryohashiryo
提出日時 2019-05-12 17:42:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 460 ms / 2,000 ms
コード長 1,341 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 97,968 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 07:22:58
合計ジャッジ時間 6,645 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 12 ms
4,348 KB
testcase_02 AC 153 ms
4,348 KB
testcase_03 AC 136 ms
4,348 KB
testcase_04 AC 459 ms
4,348 KB
testcase_05 AC 430 ms
4,348 KB
testcase_06 AC 201 ms
4,348 KB
testcase_07 AC 49 ms
4,348 KB
testcase_08 AC 321 ms
4,348 KB
testcase_09 AC 32 ms
4,348 KB
testcase_10 AC 166 ms
4,348 KB
testcase_11 AC 117 ms
4,348 KB
testcase_12 AC 324 ms
4,348 KB
testcase_13 AC 216 ms
4,348 KB
testcase_14 AC 9 ms
4,348 KB
testcase_15 AC 392 ms
4,348 KB
testcase_16 AC 408 ms
4,348 KB
testcase_17 AC 70 ms
4,348 KB
testcase_18 AC 25 ms
4,348 KB
testcase_19 AC 451 ms
4,348 KB
testcase_20 AC 138 ms
4,348 KB
testcase_21 AC 62 ms
4,348 KB
testcase_22 AC 64 ms
4,348 KB
testcase_23 AC 231 ms
4,348 KB
testcase_24 AC 3 ms
4,348 KB
testcase_25 AC 460 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;cin>>N;
  long double p,q;cin>>p>>q;
  double ans;
  long double r[N+1],l[N+1];
  fill(r,r+N+1,0.2);
  fill(l,l+N+1,0.2);
  r[0] = 1;
  l[N]=0;
  repeat(j,50000){
    for(int i=1;i<=N;i++){
      r[i] = q*r[i-1]+p*l[i];
    }
    for(int i=N-1;i>=0;i--){
      l[i] = q*l[i+1]+p*r[i];
    }
  }
  ans = l[0];
  printf("%.5lf\n",ans);
  return 0;
}
0