QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#309175#8151. 靠谱的预言家Lynkcat90 48ms183376kbC++201.1kb2024-01-20 15:22:402024-01-20 15:22:42

Judging History

你现在查看的是最新测评结果

  • [2024-01-20 15:22:42]
  • 评测
  • 测评结果:90
  • 用时:48ms
  • 内存:183376kb
  • [2024-01-20 15:22:40]
  • 提交

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
// #define int ll
// #define N 
using namespace std;
double dp[5005][5005];
const int B=5000;
double x,y;
void BellaKira()
{
	if (x>=y)
	{
		cout<<1<<'\n';
		return;
	}
	if (x<=0.5)
	{
		cout<<-1<<'\n';
		return;
	}
	dp[0][0]=1.0;
	for (int i=1;i<=B;i++)
	{
		for (int j=0;j<=i;j++) dp[i][j]=0;
		for (int j=0;j<=i-1;j++)
		{
			dp[i][j]+=dp[i-1][j]*(1.0-x);
			dp[i][j+1]+=dp[i-1][j]*x;
		}
		double all=0;
		for (int j=0;j<=i;j++)
			if (j*2>i) all+=dp[i][j];
		if (all>=y)
		{
			cout<<i<<'\n';
			return;
		}
	}
	// cout<<"woc"<<endl;
}
signed main()
{
	// freopen("1.in","r",stdin);
	IOS;
	cin.tie(0);
	int T=1;
	// cin>>T;
	while (cin>>x>>y)
	{
		BellaKira();
	}
}
/*list:
1.mod 998244353 or 1e9+7 or ???
2.N
3.duipai shuju xingtai duoyidian
...
*/ 

詳細信息

Test #1:

score: 10
Accepted
time: 1ms
memory: 5836kb

input:

0.23 0.80
0.56 0.62
0.70 0.84
0.40 0.70
0.82 0.44
0.71 0.88
0.64 0.92
0.12 0.92
0.38 0.84
0.70 0.89

output:

-1
7
7
-1
1
7
25
-1
-1
9

result:

ok 10 numbers

Test #2:

score: 10
Accepted
time: 0ms
memory: 3828kb

input:

0.81 0.97
0.38 0.81
0.79 0.83
0.61 0.33
0.92 0.39
0.22 0.94
0.20 0.98
0.97 0.56
0.52 0.54
0.69 0.89

output:

7
-1
3
1
1
-1
-1
1
7
11

result:

ok 10 numbers

Test #3:

score: 10
Accepted
time: 1ms
memory: 5836kb

input:

0.62 0.88
0.50 0.68
0.30 0.52
0.61 0.92
0.40 0.57
0.41 0.63
0.96 0.82
0.66 0.82
0.07 0.13
0.61 0.69

output:

23
-1
-1
41
-1
-1
1
9
-1
5

result:

ok 10 numbers

Test #4:

score: 10
Accepted
time: 1ms
memory: 3748kb

input:

0.58 0.02
0.03 0.88
0.78 0.47
0.92 0.38
0.24 0.72
0.69 0.80
0.59 0.24
0.20 0.60
0.15 0.90
0.19 0.77

output:

1
-1
1
1
-1
5
1
-1
-1
-1

result:

ok 10 numbers

Test #5:

score: 10
Accepted
time: 2ms
memory: 24392kb

input:

0.01 0.31
0.66 0.75
0.38 0.83
0.39 0.88
0.37 0.82
0.01 0.92
0.60 0.64
0.53 0.92
0.66 0.94
0.66 0.01

output:

-1
5
-1
-1
-1
-1
3
547
23
1

result:

ok 10 numbers

Test #6:

score: 10
Accepted
time: 1ms
memory: 6000kb

input:

0.20 0.90
0.55 0.81
0.43 0.72
0.72 0.80
0.07 0.50
0.42 0.56
0.18 0.91
0.96 0.96
0.52 0.37
0.55 0.71

output:

-1
77
-1
3
-1
-1
-1
1
1
31

result:

ok 10 numbers

Test #7:

score: 10
Accepted
time: 0ms
memory: 14124kb

input:

0.66 0.63
0.63 0.91
0.57 0.99
0.58 0.92
0.04 0.32
0.47 0.71
0.15 0.72
0.60 0.09
0.61 0.63
0.06 0.69

output:

1
27
273
77
-1
-1
-1
1
3
-1

result:

ok 10 numbers

Test #8:

score: 10
Accepted
time: 0ms
memory: 3732kb

input:

0.74 0.85
0.04 0.85
0.54 0.57
0.72 0.48
0.38 0.72
0.31 0.52
0.47 0.77
0.96 0.39
0.10 0.05
0.16 0.99

output:

5
-1
5
1
-1
-1
-1
1
1
-1

result:

ok 10 numbers

Test #9:

score: 10
Accepted
time: 3ms
memory: 57032kb

input:

0.52 0.93
0.10 0.74
0.11 0.57
0.45 0.79
0.01 0.48
0.55 0.61
0.18 0.94
0.18 0.21
0.52 0.62
0.18 0.66

output:

1361
-1
-1
-1
-1
9
-1
-1
59
-1

result:

ok 10 numbers

Test #10:

score: 0
Wrong Answer
time: 48ms
memory: 183376kb

input:

0.90 0.32
0.66 0.93
0.51 0.99
0.52 0.99
0.51 0.98
0.60 0.51
0.99 0.95
0.07 0.63
0.85 0.95
0.55 0.89

output:

1
21
3381
1
1
-1
5
151

result:

wrong answer 3rd numbers differ - expected: '13527', found: '3381'