Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
73619 | zzy2023 | 抄近路 | C++ | 通过 | 100 | 10 MS | 12052 KB | 593 | 2023-04-08 08:56:18 |
using namespace std; double dp[1005][1005]; int pd[1005][1005],n,m,k,x,y; int main() { cin>>n>>m>>k; for(int i=1;i<=k;i++) { cin>>x>>y; pd[x][y]=1; } for(int i=1;i<=n;i++) { dp[i][0]=i*100; } for(int i=1;i<=m;i++) { dp[0][i]=i*100; } for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(pd[i][j]==1) { dp[i][j]=min(min(dp[i-1][j]+100,dp[i][j-1]+100),dp[i-1][j-1]+141.42); } else { dp[i][j]=min(dp[i-1][j]+100,dp[i][j-1]+100); } } } cout<<int(dp[n][m]+0.5); return 0; }
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0