結果

問題 No.1042 愚直大学
ユーザー Y17
提出日時 2020-05-01 21:57:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 586 bytes
コンパイル時間 1,843 ms
コンパイル使用メモリ 168,032 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-25 04:11:29
合計ジャッジ時間 2,856 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

double p, q;
bool isOK(double n){
	return n*n <= p+q*n*log2(n);
}

signed main(){
	cin >> p >> q;

	double l, r;
	l = 1;
	r = 1e18;

	int cnt = 0;
	while(r-l > 1e-6){
		double mid = (r+l)/2;
		if(isOK(mid)) l = mid;
		else r = mid; 
		cnt++;
		if(cnt == 1000){
			break;
		}
	}

	cout << cnt << endl;

	printf("%.12lf\n", l);

	return 0;
}
0