提交时间:2023-04-08 11:49:00

运行 ID: 73699

#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; }