結果

問題 No.1807 UMA Gacha
ユーザー friedrice
提出日時 2024-12-06 20:47:50
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 5,521 ms
コンパイル使用メモリ 309,260 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-06 20:47:57
合計ジャッジ時間 7,013 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;
using maxt = atcoder::modint1000000007;
double my_pow(int n, double p) {
  if(n == 1) {
    return p;
  }
  double ans = my_pow(n / 2, p) * my_pow(n / 2, p);
  if(n % 2 == 1) {
    ans *= p;
  }
  return ans;
}

int main() {
	int N;
	double P;
	cin >> N >> P;
	if(N < 200) {
	  cout << fixed << setprecision(6);
	  cout << 1 - my_pow(N, 1 - P) << endl;
	}
	else {
	  cout << 1 << endl;
	}
}
0