QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#401319#6749. Targetyueboss#WA 1ms3844kbC++14873b2024-04-28 14:38:562024-04-28 14:38:57

Judging History

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

  • [2024-04-28 14:38:57]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3844kb
  • [2024-04-28 14:38:56]
  • 提交

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