QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#414343#6749. Targetfuyouyufeng#WA 0ms3704kbC++17804b2024-05-18 21:39:402024-05-18 21:39:41

Judging History

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

  • [2024-05-18 21:39:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2024-05-18 21:39:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int p = 998244353;
double s = 0.5;
bool check(double a, double b)
{
    return abs(a - b) <= 1e-4;
}
vector<int> res;
bool flag = false; 
void dfs(double a, double b, int op)
{
    if(op == 50)
    {
        return;
    }

	if(flag == true){
		return;
	}
    if (check(a, b))
    {
    	for(int i = 0;i<res.size();i++)
    	{
    		cout <<res[i] << " ";
		}
    	flag =true;
    	return;
	}

    double pre = a;
    a = a / 2;
    res.push_back(1);
    dfs(a, b, op + 1);
    a = pre;
    res.pop_back();
    res.push_back(2);
    pre = a;
    a = a / 2 + 0.5;
    dfs(a, b, op + 1);
    res.pop_back();
    a = pre;
}

int main()
{
    double a, b;
    cin >> a >> b;
    dfs(a, b, 0);
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3704kb

input:

0.5 0.25

output:

1 

result:

wrong answer wa