求助
查看原帖
求助
212423
FrozenDream楼主2022/8/14 14:44

先把操作1和操作2打了,但是是0pts,下了样例结果一模一样,求调。

#include<bits/stdc++.h>
using namespace std;
int m,n,hm,hr,hc,hx,hy,iceb,cold[20][20],fxr[8]={-1,-1,0,1,1,1,0,-1},fxc[8]={0,-1,-1,-1,0,1,1,1};
void ICE_BARRAGE(int r,int c,int d,int s){
	int k=0;
	while(s+1!=0&&r>=0&&c>=0&&r<n&&c<n&&cold[r][c]<=4){
		cold[r][c]++;
		cold[r][c]=min(4,cold[r][c]);
		s--;
		r+=fxr[d];
		c+=fxc[d];
		k++;
	}
	cout<<"CIRNO FREEZED "<<k<<" BLOCK(S)"<<endl;
}
void MAKE_ICE_BLOCK(){
	int k=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(cold[i][j]==4){
				cold[i][j]=0;
				k++;iceb++;
			}
		}
	}
	cout<<"CIRNO MADE "<<k<<" ICE BLOCK(S),NOW SHE HAS "<<iceb<<" ICE BLOCK(S)"<<endl;
}
void check(){
	string a;
	cin>>a;
	if(a=="ICE_BARRAGE"){
		int r,c,d,s;
		cin>>r>>c>>d>>s;
		ICE_BARRAGE(r,c,d,s);
	}else if(a=="MAKE_ICE_BLOCK"){
		MAKE_ICE_BLOCK();
	}
}
int main(){
	cin>>n>>hm>>hr>>hc>>hx>>hy>>m;
	for(int i=1;i<=m;i++){
		check();
	}
}
2022/8/14 14:44
加载中...