QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#411054#6749. TargetwangyuWA 1ms3720kbC++14362b2024-05-14 20:51:082024-05-14 20:51:09

Judging History

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

  • [2024-05-14 20:51:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3720kb
  • [2024-05-14 20:51:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
double a,b,s=0.5,p;
string k;
int main()
{
	cin>>a>>b;
	while(a!=b&&k.length()<=50)
	{
		if(a>b)
		{
			k.push_back('1');
		    a=a*s;
		}
		else if(a<b)
		{
			k.push_back('2');
		    a=(a-1)*s+1;
		}
	    p=abs(a-b);
	    if(p<=0.0001)
		{
		    a=b;
	    }
	}
	cout<<k;

	return 0;
	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3720kb

input:

0.361954 0.578805

output:

212121212121212121212121212121212121212121212121212

result:

wrong answer wa