結果

問題 No.2461 一点張り
ユーザー 👑 Nachia
提出日時 2021-05-26 16:55:32
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 645 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 24,832 KB
最終ジャッジ日時 2025-01-21 18:36:15
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:2:10: fatal error: testlib.h: No such file or directory
    2 | #include "testlib.h"
      |          ^~~~~~~~~~~
compilation terminated.

ソースコード

diff #

#include "testlib.h"

#include <cstdio>
#include <string>
using namespace std;

const int maxK = 10'000'000;

int main() {
  registerValidation();
  
  int T = inf.readInt(1,1000,"T");
  inf.readEoln();

  for(int testcase_id=1; testcase_id<=T; testcase_id++){
    std::string testcase_id_s = " for testcase " + vtos(testcase_id);
    double p = inf.readStrictReal(0.0,1.0,1,10,"p"+testcase_id_s);
    inf.readSpace();
    int K = inf.readInt(0,maxK,"K"+testcase_id_s);
    inf.readEoln();

		if(p == 0){
			printf("%d\n",K);
		}
		else{
			double ans = (1.0-pow(1.0-p,K)) / p;
			printf("%.12f\n",ans);
		}
  }

  inf.readEof();
  return 0;
}
0