QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#516366#8795. Mysterious SequenceSocialPandaAC ✓0ms4128kbC++231.4kb2024-08-12 16:28:402024-08-12 16:28:41

Judging History

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

  • [2024-08-12 16:28:41]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:4128kb
  • [2024-08-12 16:28:40]
  • 提交

answer

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
//#define int long long
//#define LL long long
#define double long double
//#define lf Lf
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define PII pair<int,int>
#define Gheap priority_queue<int,vector<int>,greater<int>>
#define Lheap priority_queue<int>
#define MAXN 0x3f3f3f3f
#define MINN -0x3f3f3f3f
using namespace std;
//const int N=1e6+100,M=2*N;
//int e[N],w[M],h[M],ne[M],idx;

double aa,bb,bg,ed;
double eps = 1e-8;
int n;

bool check(double num)
{
	double preB=bg;
	double preA=num;
	for(int i=3;i<=n;i++)
	{
		double newone = preA*aa+preB*bb;
		preB=preA;
		preA=newone;
	}
	if(preA-ed>eps) return false;
	else return true;
}

void solve()
{
	unordered_map<char,double> mp;
	cin>>aa>>bb>>n>>bg>>ed;

	double ll=-20000.0,rr=20000.0;

	while(rr-ll>eps)
	{
		double mid = (ll+rr)/2.0;
		if(check(mid)) ll=mid;
		else rr=mid;
	}

	printf("%.9Lf\n",bg);
	if(n>2)
	{
		printf("%.9Lf\n",ll);
		double preB=bg;
		double preA=ll;
		for(int i=3;i<n;i++)
		{
			double newone = preA*aa+preB*bb;
			preB=preA;
			preA=newone;
			printf("%.9Lf\n",newone);
		}
	}
	printf("%.9Lf\n",ed);
    
}

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int tt=1;
    //cin >> tt;
    while(tt--) solve();
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3820kb

input:

1.0 1.0 10 1 10

output:

1.000000000
-0.323529412
0.676470588
0.352941177
1.029411765
1.382352942
2.411764707
3.794117649
6.205882356
10.000000000

result:

ok 10 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 4008kb

input:

1 1 2 1 100

output:

1.000000000
100.000000000

result:

ok 2 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 4004kb

input:

1 1 5 50 100

output:

50.000000000
0.000000000
50.000000000
50.000000000
100.000000000

result:

ok 5 numbers

Test #4:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

0.25 0.25 10 1 1

output:

1.000000000
55.875537037
14.218884259
17.523605324
7.935622396
6.364806930
3.575107331
2.484978565
1.515021474
1.000000000

result:

ok 10 numbers

Test #5:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

0.25 0.63 6 93 12

output:

93.000000000
-14.204807940
55.038798015
4.810670502
35.877110375
12.000000000

result:

ok 6 numbers

Test #6:

score: 0
Accepted
time: 0ms
memory: 4048kb

input:

0.25 0.80 10 5 63

output:

5.000000000
78.769536194
23.692384049
68.938724967
36.188588481
64.198127094
45.000402558
62.608602315
51.652472625
63.000000000

result:

ok 10 numbers

Test #7:

score: 0
Accepted
time: 0ms
memory: 3964kb

input:

0.25 0.99 3 18 30

output:

18.000000000
48.720000032
30.000000000

result:

ok 3 numbers

Test #8:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

0.28 0.64 9 6 10

output:

6.000000000
20.950403368
9.706112943
16.125969780
10.727183822
13.324232129
10.596182642
11.494439702
10.000000000

result:

ok 9 numbers

Test #9:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

0.31 0.40 7 10 49

output:

10.000000000
240.115064043
78.435669853
120.361083272
68.686203756
69.437156473
49.000000000

result:

ok 7 numbers

Test #10:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

0.32 0.28 5 36 6

output:

36.000000000
10.121376854
13.318840593
7.096014509
6.000000000

result:

ok 5 numbers

Test #11:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

0.35 0.65 10 86 82

output:

86.000000000
79.533924800
83.736873680
81.004956908
82.780702810
81.626467973
82.376720617
81.889056399
82.206038141
82.000000000

result:

ok 10 numbers

Test #12:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

0.36 0.68 8 72 59

output:

72.000000000
38.239918649
62.726370714
48.584638138
60.144401815
54.689538588
60.586427126
59.000000000

result:

ok 8 numbers

Test #13:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

0.43 0.61 2 93 84

output:

93.000000000
84.000000000

result:

ok 2 numbers

Test #14:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

0.46 0.96 6 65 35

output:

65.000000000
-16.617423662
54.755985116
9.235026438
56.813857872
35.000000000

result:

ok 6 numbers

Test #15:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

0.50 0.90 4 19 1

output:

19.000000000
-6.565217391
13.817391305
1.000000000

result:

ok 4 numbers

Test #16:

score: 0
Accepted
time: 0ms
memory: 4012kb

input:

0.54 0.35 3 16 22

output:

16.000000000
30.370370387
22.000000000

result:

ok 3 numbers

Test #17:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

0.55 0.89 10 74 13

output:

74.000000000
-48.321937074
39.282934609
-21.400909961
23.191311323
-6.291588638
17.179893327
3.849427442
17.407290154
13.000000000

result:

ok 10 numbers

Test #18:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

0.56 0.36 3 31 88

output:

31.000000000
137.214285724
88.000000000

result:

ok 3 numbers

Test #19:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

0.57 0.93 7 71 48

output:

71.000000000
-34.080565365
46.604077742
-5.130601477
40.417349458
18.266429818
48.000000000

result:

ok 7 numbers

Test #20:

score: 0
Accepted
time: 0ms
memory: 4108kb

input:

0.58 0.41 8 30 69

output:

30.000000000
89.432121695
64.170630583
73.886135633
69.163917206
70.408387589
69.194070856
69.000000000

result:

ok 8 numbers

Test #21:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

0.58 0.49 6 31 96

output:

31.000000000
99.557613548
72.933415858
91.084611836
88.566448635
96.000000000

result:

ok 6 numbers

Test #22:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

0.61 0.29 8 62 25

output:

62.000000000
34.407651274
38.968667277
33.749105908
31.887868114
29.238840263
27.083174314
25.000000000

result:

ok 8 numbers

Test #23:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

0.63 0.89 9 37 85

output:

37.000000000
-5.887853304
29.220652419
13.168821584
34.302738250
33.330976307
51.527952116
62.127178746
85.000000000

result:

ok 9 numbers

Test #24:

score: 0
Accepted
time: 0ms
memory: 4048kb

input:

0.64 0.67 2 74 42

output:

74.000000000
42.000000000

result:

ok 2 numbers

Test #25:

score: 0
Accepted
time: 0ms
memory: 4108kb

input:

0.65 0.56 2 94 96

output:

94.000000000
96.000000000

result:

ok 2 numbers

Test #26:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

0.65 0.90 10 97 23

output:

97.000000000
-61.703576284
47.192675415
-24.857979636
26.315721110
-5.266962951
20.260623081
8.429138347
23.713500699
23.000000000

result:

ok 10 numbers

Test #27:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

0.67 0.88 4 70 42

output:

70.000000000
0.547821510
61.967040412
42.000000000

result:

ok 4 numbers

Test #28:

score: 0
Accepted
time: 0ms
memory: 4016kb

input:

0.69 0.39 10 2 27

output:

2.000000000
22.365907689
16.212476306
19.909312650
20.060291487
21.606233060
22.731814491
24.111382892
25.502261847
27.000000000

result:

ok 10 numbers

Test #29:

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

input:

0.69 0.57 4 88 47

output:

88.000000000
11.843609600
58.332090624
47.000000000

result:

ok 4 numbers

Test #30:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

0.71 0.89 8 4 41

output:

4.000000000
6.838890358
8.415612154
12.061697048
16.053699722
22.133037176
30.002249147
41.000000000

result:

ok 8 numbers

Test #31:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

0.72 0.49 8 21 48

output:

21.000000000
19.940442371
24.647118507
27.516742087
31.889142371
36.443386130
41.864917775
48.000000000

result:

ok 8 numbers

Test #32:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

0.74 0.58 3 57 29

output:

57.000000000
-5.486486480
29.000000000

result:

ok 3 numbers

Test #33:

score: 0
Accepted
time: 0ms
memory: 4128kb

input:

0.76 0.70 2 91 18

output:

91.000000000
18.000000000

result:

ok 2 numbers

Test #34:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

0.77 0.36 10 31 25

output:

31.000000000
5.214972089
15.175528508
13.562546903
15.906351378
17.130407447
18.916700230
20.732805858
22.774272594
25.000000000

result:

ok 10 numbers

Test #35:

score: 0
Accepted
time: 0ms
memory: 4032kb

input:

0.77 0.96 8 78 68

output:

78.000000000
-40.097557012
44.004881101
-4.609896284
38.695065718
25.369700171
56.681932221
68.000000000

result:

ok 8 numbers

Test #36:

score: 0
Accepted
time: 0ms
memory: 4048kb

input:

0.78 0.52 7 73 77

output:

73.000000000
8.727547511
44.767487058
39.456964611
54.055525667
62.680931618
77.000000000

result:

ok 7 numbers

Test #37:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

0.78 0.69 4 42 97

output:

42.000000000
57.297905114
73.672365989
97.000000000

result:

ok 4 numbers

Test #38:

score: 0
Accepted
time: 0ms
memory: 4108kb

input:

0.78 0.70 10 54 99

output:

54.000000000
-13.012886357
27.649948642
12.457939491
29.072156852
31.396839989
44.840044988
56.953023082
75.811389496
99.000000000

result:

ok 10 numbers

Test #39:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

0.78 0.76 10 97 83

output:

97.000000000
-43.734736964
39.606905168
-2.345014062
28.272136959
20.270056141
37.297467879
44.497267613
63.053944326
83.000000000

result:

ok 10 numbers

Test #40:

score: 0
Accepted
time: 0ms
memory: 4020kb

input:

0.78 0.95 10 100 32

output:

100.000000000
-63.269578823
45.649728518
-24.499311637
24.257779015
-4.353278423
19.649332894
11.190865155
27.395741071
32.000000000

result:

ok 10 numbers

Test #41:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

0.79 0.90 10 98 42

output:

98.000000000
-58.246914632
42.184937441
-19.096122591
22.880506850
0.889090080
21.294837328
17.623102561
33.087604619
42.000000000

result:

ok 10 numbers

Test #42:

score: 0
Accepted
time: 0ms
memory: 4112kb

input:

0.81 0.48 10 97 1

output:

97.000000000
-38.257501683
15.571423637
-5.750747662
2.816177740
-0.479254909
0.963568839
0.550448403
0.908376249
1.000000000

result:

ok 10 numbers

Test #43:

score: 0
Accepted
time: 0ms
memory: 4012kb

input:

0.81 0.86 10 20 100

output:

20.000000000
-3.332842871
14.500397275
8.879076924
19.662393964
23.562545265
35.995320474
49.419998512
70.986174403
100.000000000

result:

ok 10 numbers

Test #44:

score: 0
Accepted
time: 0ms
memory: 4112kb

input:

0.84 0.85 10 74 95

output:

74.000000000
-36.290804883
32.415723898
-3.617976076
24.514265410
17.516703280
35.551156354
44.752169125
67.810304966
95.000000000

result:

ok 10 numbers

Test #45:

score: 0
Accepted
time: 0ms
memory: 4128kb

input:

0.88 0.37 10 3 96

output:

3.000000000
29.021828486
26.649209068
34.189380520
39.946862212
47.803309539
56.847251413
67.712805773
80.620752103
96.000000000

result:

ok 10 numbers

Test #46:

score: 0
Accepted
time: 0ms
memory: 4128kb

input:

0.91 0.50 10 100 98

output:

100.000000000
-22.586857858
29.445959349
15.502394079
28.830158286
33.986641080
45.342922525
58.255380038
75.683857097
98.000000000

result:

ok 10 numbers

Test #47:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

0.94 0.48 10 44 97

output:

44.000000000
-1.582743444
19.632221163
17.694571040
26.056362936
32.986375259
43.514246953
56.736852260
74.219479662
97.000000000

result:

ok 10 numbers

Test #48:

score: 0
Accepted
time: 0ms
memory: 4048kb

input:

0.94 0.54 10 28 95

output:

28.000000000
0.452546301
15.545393523
14.857044914
22.360134722
29.041330892
39.373323788
52.693243042
70.793243305
95.000000000

result:

ok 10 numbers

Test #49:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

0.95 0.57 10 2 94

output:

2.000000000
9.227284172
9.905919963
14.670175943
19.583041525
26.965889737
36.779928920
50.311489624
68.760474626
94.000000000

result:

ok 10 numbers

Test #50:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

0.98 0.90 10 21 99

output:

21.000000000
-8.213193487
10.851070383
3.242174837
12.943294685
15.602386144
26.939303638
40.442665095
63.879185067
99.000000000

result:

ok 10 numbers

Extra Test:

score: 0
Extra Test Passed