QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#401319 | #6749. Target | yueboss# | WA | 1ms | 3844kb | C++14 | 873b | 2024-04-28 14:38:56 | 2024-04-28 14:38:57 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5, mod = 1e9 + 7, P = 1e9 + 9;
const int inf = 0x3f3f3f3f;
#define endl '\n'
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
int T; ll n, m;
int ans[55];
db a, b, s = 0.5; bool f;
void dfs(db x, int cnt) {
if(cnt > 51 || b - (x*s + 0.5) > 0.0004 || f) return;
if(abs(x-b) <= 0.0004) {
for(int i = 1; i < cnt; i++) {
cout << ans[i];
}
f = 1;
return;
}
ans[cnt] = 1;
dfs(x*s, cnt+1);
ans[cnt] = 2;
dfs(x*s + 0.5, cnt+1);
}
void solve() {
cin >> a >> b;
if(a == b) {
cout << 2 << endl;
return;
}
dfs(a, 1);
}
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
T = 1;
//cin >> T;
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3796kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3836kb
input:
1 0
output:
111111111111
result:
wrong answer wa