#include <iostream>
#include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
const int N=105;
int n,m,r,c;
int T;
int time;
int tot[2];
int sx,sy;
int dirx[]={0,0,1,-1};
int diry[]={1,-1,0,0};
int now;
int a[N][N];
int xx[N*N],yy[N*N];
int res[N][N];
int ans[N*N];
struct drop{
int x,y;
int dx,dy;
}d[2][N*N];
void init(){
memset(a,0,sizeof a);
memset(ans,0,sizeof ans);
tot[0]=4;
now=0;
}
void solve(int time){
tot[now^1]=0;
for(int i=0;i<tot[now];i++){
drop t=d[now][i];
t.x+=t.dx;
t.y+=t.dy;
if(t.x<1 || t.x>r || t.y<1 || t.y>c) continue;
if(a[t.x][t.y]) {
a[t.x][t.y]++;
}else{
d[now^1][tot[now^1]++]=drop{t.x,t.y,t.dx,t.dy};
}
}
for(int i=0;i<n;i++){
int x=xx[i],y=yy[i];
hdu5336 十滴水游戏的模拟
最新推荐文章于 2020-08-05 14:25:25 发布
该博客介绍了如何使用C++编程实现十滴水游戏的模拟。通过初始化矩阵、处理滴水路径及更新矩阵,解决游戏过程中水滴碰撞和扩散的问题。在main函数中,读取游戏参数并进行模拟计算,输出每滴水在游戏结束时的状态。
摘要由CSDN通过智能技术生成