QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#660925#6749. Targetucup-team1769#WA 0ms3840kbC++201.1kb2024-10-20 13:57:272024-10-20 13:57:28

Judging History

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

  • [2024-10-20 13:57:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2024-10-20 13:57:27]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	double a, b;
	std::cin >> a >> b;

	if (a != b && a == 1.) {
		std::cout << 1;
		a /= 2;
	}
	if (a == b) {
		return 0;
	}

	std::vector<int> A, B;
	double base = 0.5;
	while (A.size() < 50) {
		if (a >= base) {
			A.emplace_back(1);
			a -= base;
		} else {
			A.emplace_back(0);
		}
		base /= 2;
	}
	base = 0.5;
	while (B.size() < 50) {
		if (b >= base) {
			B.emplace_back(1);
			b -= base;
		} else {
			B.emplace_back(0);
		}
		base /= 2;
	}

	// std::cerr << "Yes\n";

	for (int i = 0, j = 50; i < 50 && j > 0; i++, j--) {
		int l = i, r = 0;
		while (l < 50 && r < j && A[r] == B[l]) {
			l++, r++;
		}
		// std::cerr << "Yes\n";
		if (l == 50 && r == j) {
			// std::cerr << i << " " << j << "\n";
			for (int _ = i - 1; _ >= 0; _--) {
				if (B[_]) {
					std::cout << 2;
				} else {
					std::cout << 1;
				}
			}
			std::cout << "\n";
			return 0;
		}
	}

	for (int i = 0; i < 50; i++) {
		std::cout << 1;
	}
	std::cout << "\n";

	return 0;
}

详细

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3840kb

input:

1 0

output:

111111111111111111111111111111111111111111111111111

result:

wrong answer wa