QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#436623 | #8795. Mysterious Sequence | ucup-team3695# | WA | 1ms | 3936kb | C++20 | 516b | 2024-06-09 02:12:56 | 2024-06-09 02:12:56 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
double a, b;
int n;
double x, z;
cin >> a >> b >> n >> x >> z;
vector<pair<double, double>> C(2);
C[0] = {1, 0};
C[1] = {0, 1};
while (size(C) < n)
{
auto [c, d] = C[size(C) - 2];
auto [e, f] = C[size(C) - 1];
C.emplace_back(c * a + e * b, d * a + f * b);
}
auto [p, q] = C.back();
double y = (z - p * x) / q;
cout << fixed << setprecision(8);
for (auto [c, d] : C)
{
cout << c * x + d * y << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3856kb
input:
1.0 1.0 10 1 10
output:
1.00000000 -0.32352941 0.67647059 0.35294118 1.02941176 1.38235294 2.41176471 3.79411765 6.20588235 10.00000000
result:
ok 10 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
1 1 2 1 100
output:
1.00000000 100.00000000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
1 1 5 50 100
output:
50.00000000 0.00000000 50.00000000 50.00000000 100.00000000
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.25 0.25 10 1 1
output:
1.00000000 55.87553648 14.21888412 17.52360515 7.93562232 6.36480687 3.57510730 2.48497854 1.51502146 1.00000000
result:
ok 10 numbers
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3860kb
input:
0.25 0.63 6 93 12
output:
93.00000000 -2.19689516 21.86595605 13.22632852 13.79907598 12.00000000
result:
wrong answer 2nd numbers differ - expected: '-14.2048080', found: '-2.1968952', error = '0.8453414'