Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
73699 | 赖原骐23140 | 抄近路 | C++ | 解答错误 | 0 | 13 MS | 11488 KB | 596 | 2023-04-08 11:49:00 |
#include<iostream> #include<cmath> #include<cstdio> #include<cstdlib> using namespace std; bool a[1145][1145]; double b[1145][1145]; bool maxm(double RSG,double Wolves) { return RSG>Wolves?RSG:Wolves; } int main() { int n,m,k,x,y; cin>>n>>m; cin>>k; for(int i=1;i<=k;i++) { cin>>x>>y; a[x][y]=1; } for(int i=1;i<=n+1;i++) { for(int j=2;j<=m;j++) { if(a[i-1][j-1]==1) b[i][j]=maxm(maxm(b[i-1][j]+100,b[i][j-1]+100),b[i-1][j-1]+sqrt(20000)); else b[i][j]=maxm(b[i-1][j]+100,b[i][j-1]+100); } } cout<<round(b[n+1][m]); return 0; }