QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#399392#6749. TargetszjWA 1ms3836kbC++111.2kb2024-04-26 12:14:332024-04-26 12:14:34

Judging History

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

  • [2024-04-26 12:14:34]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3836kb
  • [2024-04-26 12:14:33]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const long double PI = acos(-1);
const ll mod = 998244353;
const int maxn = 1e6 + 7;
const int P = 13331;

ll qgcd(ll a, ll b) {
    return b == 0 ? a : qgcd(b, a % b);
}

ll qpow(ll a, ll b) {
    ll ans = 1;
    while (b) {
        if (b & 1)
            ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans % mod;
}

double a, b;
int x, y;
int d[maxn];
vector<int> v;
int flag;

void dfs(int z) {
	if (d[z])
		return;
	d[z] = 1;
	if (z == y) {
		for (auto i: v) {
			cout << i;
		}
		flag = 1;
	}
	if (flag)
		return;
	if (d[z / 2] == 0 && v.size() < 50) {
		v.push_back(1);
		dfs(z / 2);
		v.pop_back();
	}
		
	if (flag == 0 && d[(z - 10000) / 2 + 10000] == 0 && v.size() < 50) {
		v.push_back(2);
		dfs((z - 10000) / 2 + 10000);
		v.pop_back();
	}
}

void solve() {
	cin >> a >> b;
	x = a * 10000;
	y = b * 10000;
	dfs(x);
}

int main() {
//    IOS;
    int T = 1;
//    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

/*

*/

详细

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

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

input:

0.361954 0.578805

output:


result:

wrong answer wa