最后一点错了
#include <bits/stdc++.h>
using namespace std;
char a[110][110];
int n,m,hp_r,st_r,de_r,hp_m,st_m,de_m,x,y,q;
void move(int x,int y)
{
if(a[x][y]=='R')
{
hp_r-=min(10,hp_r);
}
if(a[x][y]=='Q')
{
st_r+=5;
}
if(a[x][y]=='Y')
{
de_r+=5;
}
if(a[x][y]=='M')
{
int k=max(1,st_r-de_m);
int x=max(1,st_m-de_r);
hp_r+=ceil(max(1.0,hp_m*1.0/k*x));
}
}
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
cin>>a[i][j];
}
}
cin>>hp_m>>st_m>>de_m>>x>>y>>st_r>>de_r>>q;
for(int i=1;i<=q;i++)
{
int op,d;
cin>>op;
if(op==2)
{
cin>>d;
if(d==1)
{
y--;
move(x,y);
}
if(d==2)
{
y++;
move(x,y);
}
if(d==3)
{
x--;
move(x,y);
}
if(d==4)
{
x++;
move(x,y);
}
}
else
{
cout<<hp_r<<' '<<st_r<<' '<<de_r<<endl;
}
}
return 0;
}