P5006 代码输入异常退出
  • 板块学术版
  • 楼主Hathtizzz
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/10/18 21:54
  • 上次更新2024/10/19 08:26:27
查看原帖
P5006 代码输入异常退出
1054564
Hathtizzz楼主2024/10/18 21:54
#include<bits/stdc++.h>
using namespace std;
int hp,mhp,st,de,mst,mde; //hp血量,de防御,st攻击 ,加m是怪物数值 
char mp[101][101];
int maxhp;
int x,y;
int n,m,q;
void move(int x,int y,int d);
void check(int x,int y);
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>mp[i][j];	
	cin>>mhp>>mst>>mde;
	cin>>x>>y;
	cin>>hp>>st>>de;maxhp=hp;
	cin>>q;
	while(q--)
	{
		int op;
		cin>>op;
		if(op&1)
		{
			printf("%d %d %d\n",hp,st,de); //cout<<hp<<' '<<st<<' '<<de<<'\n';
		}
		else if(!(op&1))
		{
			int d;
			cin>>d;
			move(x,y,d);
		}
	}
	return 0;
} 
void move(int x,int y,int d)
{
	if(d==1) y--;
	if(d==2) y++;
	if(d==3) x--;
	else x++;
	check(x,y);
}
void check(int x,int y)
{
	if(mp[x][y]=='R') hp=min(maxhp,hp+10);
	else if(mp[x][y]=='Q') st+=5;
	else if(mp[x][y]=='Y') de+=5;
	else if(mp[x][y]=='M')
	{
		hp-=(int)max((double)1,ceil((double)max(1,st-mde)/(double)mhp)*max(1,mst-de));
	}
}
2024/10/18 21:54
加载中...