QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#828355#8774. Manhattan WalksuoWA 0ms3920kbC++20824b2024-12-23 16:10:242024-12-23 16:10:29

Judging History

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

  • [2024-12-23 16:10:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3920kb
  • [2024-12-23 16:10:24]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
    int r, c;
    long double p;
    cin >> r >> c >> p;
    long double dp[r][c];
    dp[r - 1][c - 1] = 0;
    for (int i = r - 1; i >= 0; i--) {
        for (int j = c - 1; j >= 0; j--) {
            if (i == r - 1 && j == c - 1) continue;
            long double di = (i == r - 1) ? (1 << 40) : dp[i + 1][j];
            long double dj = (j == c - 1) ? (1 << 40) : dp[i][j + 1];
            long double t = min(p, max((long double)0, dj - di));
            long double ans = t * t / 2 + t * di + (p - t) * dj;

            t = min(p, max((long double)0, di - dj));
            ans += t * t / 2 + t * dj + (p - t) * di;
            dp[i][j] = ans / 2 / p;
        }
    }

    cout << setprecision(11);
    cout << dp[0][0] << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 3 8

output:

0

result:

wrong answer 1st numbers differ - expected: '2.8750000', found: '0.0000000', error = '1.0000000'