結果

問題 No.1305 Speak of the Devil
ユーザー ocvret_ocvret_
提出日時 2020-12-14 19:29:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 541 bytes
コンパイル時間 2,225 ms
コンパイル使用メモリ 166,828 KB
実行使用メモリ 4,368 KB
最終ジャッジ日時 2023-10-20 05:10:52
合計ジャッジ時間 7,712 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 9 ms
4,348 KB
testcase_13 AC 9 ms
4,348 KB
testcase_14 AC 10 ms
4,348 KB
testcase_15 AC 9 ms
4,348 KB
testcase_16 AC 794 ms
4,348 KB
testcase_17 AC 831 ms
4,348 KB
testcase_18 AC 848 ms
4,348 KB
testcase_19 AC 334 ms
4,348 KB
testcase_20 AC 10 ms
4,348 KB
testcase_21 AC 433 ms
4,348 KB
testcase_22 AC 749 ms
4,348 KB
testcase_23 AC 274 ms
4,348 KB
testcase_24 AC 214 ms
4,348 KB
testcase_25 AC 10 ms
4,348 KB
testcase_26 AC 365 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
// #include<atcoder/all>

using namespace std;
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  cout << fixed << setprecision(20);
  ll p,q;
  cin >> p >> q;
  long double res = 0;
  long double k = 1;
  rep(i,1000000){
    k /= p;
    res += (i+1)*k;
    k *= (p-1);
  }
  cout << min(res,(long double)(q)) << "\n";
  


  return 0;
}
0