QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#411226#6749. TargetKunoSayoWA 0ms3872kbC++232.8kb2024-05-15 10:16:422024-05-15 10:16:43

Judging History

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

  • [2024-05-15 10:16:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3872kb
  • [2024-05-15 10:16:42]
  • 提交

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.975;
    cin >> u >> d;

    ull data = *(ull *) &d;

    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 = after_ans + 2; i < 50 - after_ans; ++i, ++j) {
        cout << (1 + ((data >> j) & 1));
        if (++ops >= 50) break;
    }
    if (ops < 50) {
        cout << 2;
        if (++ops < 50)
            for (int i = exp; i < 0; ++i) {
                cout << 1;
                if (++ops >= 50) break;
            }
    }
//
//    bits.push_back(1);
//    for (int i = exp; i < 0; ++i) {
//        bits.push_back(0);
//    }
//
//    reverse(bits.begin(), bits.end());
//    // 1 means 0
//    // 2 means 0.5 + as
////    cout << endl;
//    for (int i = 49; i >= 0; --i) {
//        cout << (bits[i] + 1);
//    }
}

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

詳細信息

Test #1:

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

input:

0.5 0.25

output:

11111111111111111111111111111111111111111111111211

result:

wrong answer wa