QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#526836 | #8774. Manhattan Walk | OneWan | WA | 0ms | 3832kb | C++23 | 1.8kb | 2024-08-21 21:51:01 | 2024-08-21 21:51:01 |
Judging History
answer
// ██████╗ ███╗ ██╗███████╗██╗ ██╗ █████╗ ███╗ ██╗
// ██╔═══██╗████╗ ██║██╔════╝██║ ██║██╔══██╗████╗ ██║
// ██║ ██║██╔██╗ ██║█████╗ ██║ █╗ ██║███████║██╔██╗ ██║
// ██║ ██║██║╚██╗██║██╔══╝ ██║███╗██║██╔══██║██║╚██╗██║
// ╚██████╔╝██║ ╚████║███████╗╚███╔███╔╝██║ ██║██║ ╚████║
// ╚═════╝ ╚═╝ ╚═══╝╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═══╝
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int __OneWan_2024 = [](){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
return 0;
}();
double dp[1005][1005];
int main() {
int n, m, p;
cin >> n >> m >> p;
for (int i = 1 ; i <= n ; i++) {
for (int j = 1 ; j <= m ; j++) {
if (i == 1 && j == 1) continue;
if (i == 1) {
dp[i][j] = dp[i][j - 1] + p * 0.25;
continue;
}
if (j == 1) {
dp[i][j] = dp[i - 1][j] + p * 0.25;
continue;
}
double a = dp[i - 1][j], b = dp[i][j - 1];
if (a > b) swap(a, b);
if (a + p <= b) {
dp[i][j] = a + 0.25 * p;
} else {
dp[i][j] = 0.5 * a + 0.5 * b * (p - (b - a)) / p + 0.5 * (b - a) / p * (a - (b - a) / 2);
}
}
}
cout << fixed << setprecision(10) << dp[n][m] << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3832kb
input:
2 3 8
output:
2.6250000000
result:
wrong answer 1st numbers differ - expected: '2.8750000', found: '2.6250000', error = '0.0869565'