poj3760 (百练3750) 魔兽世界

第一,看清题目!!!!!

第二,如果你总是总是WA的话,给你一个方法。

去下一个UltraCompare软件,
下载地址 ------> http://www.huacolor.com/soft/69625.html
这个东西可以将两个文本文档进行比较。

将你的所有输出保存在一个txt文件中 (fprintf总会吧)
然后复制下面我AC的代码,也保存在一个文件中,直接相比较,就能找到问题在哪。
多试几组数据,随便输入,找个几次一定可以找到问题所在。

 

我没写注释,不过相信应该还是蛮清晰的,如果慢慢看。

152K,0MS,10616B

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;

#define DRAGON 0
#define NINJIA 1
#define ICEMAN 2
#define LION 3
#define WOLF 4

class worriors
{
public:
	worriors() {}
	worriors(int newcolor,int newid,int newtype);
	void get_hp(int);
	static void init(int input);
	static int total[2];
	virtual void twice() {}
	virtual void happy(int) {}
	friend class city;
protected:
	int type;
	int id;
	int hp;
	int time;
	int color;
	int attack;
	int kill;
};
class dragon: public worriors
{
private:
public:
	dragon() {}
	dragon(int newcolor,int newid,int newtype);
	void happy(int);
};
class ninjia: public worriors
{
private:
public:
	ninjia() {}
	ninjia(int newcolor,int newid,int newtype);
};
class iceman: public worriors
{
private:
public:
	iceman() {}
	iceman(int newcolor,int newid,int newtype);
};
class lion: public worriors
{
private:
public:
	lion() {}
	lion(int newcolor,int newid,int newtype);
	~lion() {};
	void escape();
};
class wolf: public worriors
{
private:
public:
	wolf() {}
	wolf(int newcolor,int newid,int newtype);
	void twice();
};
class city
{
private:
	int id;
	int color;
	int hp;
	int last_beat_win;
public:
	worriors* data[2];
	~city()
	{
		for (int i=0;i<=1;i++)
		if (data[i]!=NULL)
		{
			delete data[i];
			data[i]=NULL;
		}
	}
	int just_beat_win;
	void creat(int);
	void input_hp();
	void output_hp();
	void beat_win(int);
	void beat();
	void go(city*,int);
	bool reach_headquater(int);
	void print_last_go();
};

int worriors::total[2]={0};
int need[5],order[2],number[2],_attack[5],worriors_temp[2],now_time;
int now_order[2][5]={
  {2,3,4,1,0},{3,0,1,2,4}};
bool head_num[2],game_over;
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值