QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#459898 | #8795. Mysterious Sequence | ucup-team2307# | WA | 0ms | 4060kb | C++20 | 899b | 2024-06-30 16:31:11 | 2024-06-30 16:31:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
#define int ll
main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cout<<fixed<<setprecision(10);
double A, B, X, Y;
int n;
cin>>A>>B>>n>>X>>Y;
if (n == 2)
cout<<X<<" "<<Y<<"\n";
else
{
double l = -1e9;
double r = 1e9;
vector<double> last;
for (int _=0; _<200; _++)
{
double m = (l+r)/2;
vector<double> v = {X, m};
while (v.size() < n)
v.pb({v[v.size()-2] * A + v.back() * B});
last = v;
if (v.back() < Y)
l = m;
else
r = m;
}
for (double d : last)
cout<<d<<"\n";
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3972kb
input:
1.0 1.0 10 1 10
output:
1.0000000000 -0.3235294118 0.6764705882 0.3529411765 1.0294117647 1.3823529412 2.4117647059 3.7941176471 6.2058823529 10.0000000000
result:
ok 10 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
1 1 2 1 100
output:
1.0000000000 100.0000000000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
1 1 5 50 100
output:
50.0000000000 -0.0000000000 50.0000000000 50.0000000000 100.0000000000
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 4060kb
input:
0.25 0.25 10 1 1
output:
1.0000000000 55.8755364807 14.2188841202 17.5236051502 7.9356223176 6.3648068670 3.5751072961 2.4849785408 1.5150214592 1.0000000000
result:
ok 10 numbers
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3832kb
input:
0.25 0.63 6 93 12
output:
93.0000000000 -2.1968951561 21.8659560517 13.2263285235 13.7990759827 12.0000000000
result:
wrong answer 2nd numbers differ - expected: '-14.2048080', found: '-2.1968952', error = '0.8453414'