QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#411212#6749. TargetKunoSayoWA 0ms3892kbC++232.5kb2024-05-15 09:59:222024-05-15 09:59:24

Judging History

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

  • [2024-05-15 09:59:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3892kb
  • [2024-05-15 09:59:22]
  • 提交

answer

#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedTypeAliasInspection"
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"

typedef unsigned long long ull;
typedef long long ll;

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>

using namespace std;

template<typename T, typename U>
T check_read(T left, U right) {
    T val;
    if (cin >> val) {
        if (val < left || val > right) {
            throw "??";
        }
        return val;
    }
    throw "?";
}

const int MAXN = 1e5 + 9;

ull mod = 998244353;

ull fpow(ull x, ull n) {
    ull ret = 1;
    while (n) {
        if (n & 1) ret = ret * x % mod;
        n >>= 1;
        x = x * x % mod;
    }
    return ret;
}

int b[10];

map<vector<char>, ull> dp;
int n;
ull divcache[12];

ull dfs(vector<char> &cur) {

    // E(..) = 1 + (1/n) E(..-1, ..)  +
    //        + (nz / n) E(..)
    // (n-nz/n) E(..) = 1 + ..
    //  E(..) = n / (n - nz) (before)
    auto it = dp.find(cur);
    if (it != dp.end()) {
        return it->second;
    }
    ull ret = 1;

    ull nz = 0;
    for (int i = 0; i < n; ++i) {
        if (cur[i] > 0) {
            --cur[i];
            ull result = dfs(cur);

            ret += result * divcache[n];
            ret %= mod;

            ++cur[i];
        } else if (cur[i] == 0) {
            ++nz;
        }
    }
    if (nz) {
        ret *= n;
        ret %= mod;
        ret *= divcache[n - nz];
        ret %= mod;
    }
    dp[cur] = ret;
    return ret;
}

void solve() {
    double u;
    double d = 0.125;
    cin >> u >> d;
    
    ull data = *(ull *) &d;

    cout << endl;
    int exp = 0;
    for (int i = 62; i >= 52; --i) {
        exp = (exp << 1) | ((data >> i) & 1);
    }
    exp -= 1023;

    int after_ans = 1 + -exp;
    int ops = 0;
    for (int i = 0, j = 51; i < 50 - after_ans; ++i, --j) {
        cout << (1 + (data >> j) & 1);
        if (++ops >= 50) return;
    }
    cout << 2;
    if (++ops >= 50) return;
    for (int i = exp; i < 0; ++i) {
        cout << 1;
        if (++ops >= 50) return;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed;
    cout.precision(18);


    int T = 1;
    while (T--) {
        solve();
    }


    return 0;
}


#pragma clang diagnostic pop

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:


11111111111111111111111111111111111111111111111211

result:

wrong answer wa