QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#395305#6749. Targetfrozen_wjlTL 0ms3856kbC++23358b2024-04-21 13:05:522024-04-21 13:05:52

Judging History

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

  • [2024-04-21 13:05:52]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3856kb
  • [2024-04-21 13:05:52]
  • 提交

answer

#include<cmath>
#include<iostream>
using namespace std;
string ans = "";
int main()
{
	int n;
	double a, b, c = 0.5, k = 0;
	cin >> a >> b;
	while (abs(a - b) >= 0.0001)
	{
		if (b > k + c)
		{
			k += c;
			a = (a + 1) / 2;
			ans += "2";
		}
		else
		{
			a /= 2;
			ans += "1";
		}
		c /= 2;
	}
	cout << ans << "\n";
	return 0;
}

詳細信息

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

212

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:


result: