QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#418406#6749. TargetTexcavator#WA 0ms3876kbC++201.1kb2024-05-23 13:40:542024-05-23 13:40:55

Judging History

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

  • [2024-05-23 13:40:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3876kb
  • [2024-05-23 13:40:54]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long
using i64 = long long;

typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<int, PII> PIII;
typedef pair<int, pair<int, bool>> PIIB;

const int N = 1e5 + 10;
const int maxn = 1e6 + 10;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;

void solve()
{
	double a, b;
	cin >> a >> b;
	int cnt = 0;
	vector<int> op;
	function<void(double)> dfs = [&](double x)
	{
		if (abs(x - b) <= 0.0001)
		{
			for (auto t : op) cout << t;
			exit(0);
		}
		cnt ++ ;
		if (cnt > 50) return;
		if (x > b)
		{
			op.push_back(1);
			dfs(1.0 * x / 2);
			op.pop_back();

			op.push_back(2);
			dfs(1.0 * x / 2 + 0.5);
			op.pop_back();
		}
		else
		{
			op.push_back(2);
			dfs(1.0 * x / 2 + 0.5);
			op.pop_back();

			op.push_back(1);
			dfs(1.0 * x / 2);
			op.pop_back();
		}
	};
	dfs(a);
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);

	int t = 1;
	// cin >> t;
	while (t--)
	{
		solve();
	}
}

详细

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

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

input:

0.361954 0.578805

output:


result:

wrong answer wa