QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#399394#6749. TargetszjWA 4ms7736kbC++111.2kb2024-04-26 12:16:162024-04-26 12:16:17

Judging History

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

  • [2024-04-26 12:16:17]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:7736kb
  • [2024-04-26 12:16:16]
  • 提交

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 - 1000000) / 2 + 1000000] == 0 && v.size() < 50) {
		v.push_back(2);
		dfs((z - 1000000) / 2 + 1000000);
		v.pop_back();
	}
}

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

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

/*

*/

詳細信息

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111111111

result:

ok ok

Test #4:

score: 0
Accepted
time: 4ms
memory: 7736kb

input:

0.361954 0.578805

output:

11111211112121212112211221111121121122121111212112

result:

ok ok

Test #5:

score: 0
Accepted
time: 3ms
memory: 7672kb

input:

0.144888 0.140086

output:

11111212211122112222111122212121122212222111211

result:

ok ok

Test #6:

score: -100
Wrong Answer
time: 3ms
memory: 7708kb

input:

0.514397 0.969399

output:


result:

wrong answer wa