大模拟 猪国杀 杀蚂蚁

杀蚂蚁

1.所有炮台是一起选择目标,选完之后一起打

2.如果蚂蚁这一秒没有移动位置,仍然要判断它是否会抗蛋糕,因为上一秒抗蛋糕的可能死了

3.蚂蚁的半径是0.5

4.只有洞口没有蚂蚁时新蚂蚁才会出来

链表存蚂蚁比较方便

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 400005
using namespace std;
int n,m,T;
int num_po,hurt,R,pos_cake;//pos_cake 蛋糕在的蚂蚁编号
int cnt=0,now;
int last,pre[maxn],nex[maxn];
int vis[10][10],w[10][10];
bool die[maxn];
struct node
{   
    int w,f;
}b[5];
struct node2
{
    double dis;
    int id;
}c[maxn];
bool cmp(const node&x,const node&y)
{
    return x.w==y.w ? x.f<y.f : x.w>y.w;
} 
bool cmp2(const node2&x,const node2&y)
{
    return x.dis==y.dis ? x.id<y.id : x.dis<y.dis; 
}
inline int read()
{
    int x=0;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=getchar();
    while(ch>='0'&&ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
    return x;
}
double sq(int x)//平方
{
    return (double)x*(double)x*1.0;
}
struct Ant//蚂蚁信息
{
    int id;
    int x,y,lastx,lasty;//当前位置 上一次位置
    int blood,age,d,ti,bl;//血量 年龄 等级 活动时间 初始血量
    bool cake; //有没有抗蛋糕
    double quickpow(int x)
    {
        double op=1.0,e=1.1;
        while(x){   
            if(x&1) op*=e;
            e*=e;
            x>>=1;  
        }
        return op;
    }
    void init()
    {
        id=cnt;        
        if(id%6==0) d=id/6;
        else d=id/6+1;    
        blood=(int)((double)4*quickpow(d)); 
        bl=blood;
        age=ti=x=y=0;
        lastx=lasty=0;
        vis[x][y]++; //该点的蚂蚁数
    }
    void
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值