QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#435202#8795. Mysterious Sequenceucup-team3651#WA 0ms4012kbC++20717b2024-06-08 19:15:492024-06-08 19:15:51

Judging History

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

  • [2024-06-08 19:15:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4012kb
  • [2024-06-08 19:15:49]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define arr array
using namespace std;
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9')f=(ch=='-'?-1:1),ch=getchar();
	while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x*f;
}
void write(int x){
	if(x<0)x=-x,putchar('-');
	if(x/10)write(x/10);
	putchar(x%10+'0');
}
int main(){
	double a,b;cin>>a>>b;
	double x,y;int n;cin>>n>>x>>y;
	arr<double,4> f={x,0,0,1};
	for(int i=3;i<=n;i++){
		arr<double,4> g;
		g={f[2],f[3],f[0]*a+f[2]*a,f[1]*b+f[3]*b};
		f=g;
	}
	y-=f[2];y/=f[3];
	printf("%.10lf\n",x);printf("%.10lf\n",y);
	for(int i=3;i<=n;i++){
		double z=x*a+y*b;
		x=y;y=z;printf("%.10lf\n",z);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 4012kb

input:

1 1 2 1 100

output:

1.0000000000
100.0000000000

result:

ok 2 numbers

Test #3:

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

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: 3956kb

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: 3948kb

input:

0.25 0.63 6 93 12

output:

93.0000000000
6.6922163378
27.4660962928
18.9766947489
18.8218417650
16.6019339992

result:

wrong answer 2nd numbers differ - expected: '-14.2048080', found: '6.6922163', error = '1.4711233'