QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#435210#8795. Mysterious Sequenceucup-team3651#WA 1ms4028kbC++20742b2024-06-08 19:17:242024-06-08 19:17:24

Judging History

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

  • [2024-06-08 19:17:24]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4028kb
  • [2024-06-08 19:17:24]
  • 提交

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(){
	long double a,b;cin>>a>>b;
	long double x,y;int n;cin>>n>>x>>y;
	arr<long double,4> f={x,0,0,1};
	for(int i=3;i<=n;i++){
		arr<long 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++){
		long double z=x*a+y*b;
		x=y;y=z;printf("%.10Lf\n",z);
	}
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 4024kb

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

input:

1 1 2 1 100

output:

1.0000000000
100.0000000000

result:

ok 2 numbers

Test #3:

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

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

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: 1ms
memory: 3944kb

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'