题目太长,我只发链接吧

wikioi(排版看起来舒服一点):http://www.wikioi.com/problem/1834/

bzoj:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1972

首先是题目的样例错了,第三个人有6个J

还有,数据有问题,第1,2个点牌不够用,抽完了就一直抽最后一张牌

调了一天多,我的模拟能力真TM差啊

犯了几个傻逼错误

1.让死人(反贼)继续出牌,用南蛮入侵杀死队友,导致主公获胜

2.主公杀死忠臣没有弃装备,后来用诸葛连杀掉反贼获胜

3.最烦的就是无懈可击的顺序了,先从出锦囊的人开始逆时针献殷勤,如果被无懈可击了,就回到上一个献殷勤的人的下家开始献殷勤(一开始直接往后,点都是交替错的(A对B就错),就是没有全对)

 type
aa=array[..]of char;
pig=record
pai:aa;
blood,num:longint;
zhuge,tiaozhong,tiaofan,leifan,sha:boolean;
shenfen:char;
end;
var
a:array[..]of pig;
p:array[..]of char;
n,m,now,fanzeishu:longint; procedure print;
var
i,j:longint;
begin
for i:= to n do
with a[i] do
begin
if blood> then
begin
for j:= to num do
if j<num then write(pai[j],' ')
else write(pai[j]);
end
else write('DEAD');
writeln;
end;
halt;
end; procedure MPwin;
begin
writeln('MP');
print;
end; procedure FPwin;
begin
writeln('FP');
print;
end; procedure init;
var
i,j:longint;
begin
readln(n,m);
for i:= to n do
with a[i] do
begin
read(shenfen,pai[]);
if shenfen='F' then inc(fanzeishu);
for j:= to do
read(pai[j+],pai[j]);
blood:=;
num:=;
readln;
end;
a[].tiaozhong:=true;
if fanzeishu= then MPwin;
for i:= to m do
read(p[i],p[i+]);
now:=;
end; procedure delete(var pai:aa;x:longint;var num:longint);
var
i:longint;
begin
for i:=x to num- do
pai[i]:=pai[i+];
dec(num);
end; function next(x:longint):longint;
begin
while true do
begin
x:=x mod n+;
if a[x].blood> then exit(x);
end;
end; function diyi(x,y:longint):boolean;
begin
exit(((a[x].shenfen='F') and (a[y].tiaozhong)) or ((a[x].shenfen<>'F') and (a[y].tiaofan)) or ((x=) and (a[y].leifan)));
end; function youjun(x,y:longint):boolean;
begin
exit(((a[x].shenfen='F') and (a[y].tiaofan)) or ((a[x].shenfen<>'F') and (a[y].tiaozhong)));
end; procedure mopai(x:longint);
begin
if now>m then now:=m;
with a[x] do
begin
inc(num);
pai[num]:=p[now];
inc(now);
end;
end; procedure tiao(x:longint);
begin
with a[x] do
begin
if shenfen='F' then tiaofan:=true
else tiaozhong:=true;
leifan:=false;
end;
end; function chupai(x:longint;c:char):boolean;
var
i:longint;
begin
with a[x] do
begin
for i:= to num do
if pai[i]=c then
begin
delete(pai,i,num);
exit(true);
end;
exit(false);
end;
end; procedure kill(x,y:longint);
begin
if a[y].shenfen='F' then
begin
mopai(x);
mopai(x);
mopai(x);
end;
if (x=) and (a[y].shenfen='Z') then
begin
a[x].num:=;
a[x].zhuge:=false;
end;
end; procedure decblood(x:longint);
begin
with a[x] do
begin
dec(blood);
if blood= then
begin
if chupai(x,'P')=false then
begin
if shenfen='F' then dec(fanzeishu);
if fanzeishu= then MPwin;
if shenfen='M' then FPwin;
end
else blood:=;
end;
end;
end; function dixiao(x:longint):boolean;
var
i:longint;
begin
i:=next(x);
while i<>x do
begin
if diyi(i,x) and chupai(i,'J') then
begin
tiao(i);
exit(true);
end;
i:=next(i);
end;
exit(false);
end; procedure gongji(x,y:longint);
begin
if chupai(y,'D')=false then
begin
decblood(y);
if a[y].blood= then kill(x,y);
end;
end; function jiuyuan(x,k:longint):boolean;
var
i:longint;
flag:boolean;
begin
i:=k;
flag:=true;
while true do
begin
if (i=k) and (flag=false) then break;
if i=k then flag:=false;
if (youjun(i,x)) and (chupai(i,'J')) then
begin
tiao(i);
flag:=true;
if not dixiao(i) then exit(true);
end;
i:=next(i);
end;
exit(false);
end; procedure fight(x,y:longint);
begin
if (x=) and (a[y].shenfen='Z') then
begin
decblood(y);
if a[y].blood= then kill(x,y);
end
else
if jiuyuan(y,x)=false then
begin
while true do
begin
if chupai(y,'K')=false then
begin
decblood(y);
if a[y].blood= then kill(x,y);
exit;
end;
if chupai(x,'K')=false then
begin
decblood(x);
if a[x].blood= then kill(y,x);
exit;
end;
end;
end;
end; procedure nanman(x:longint);
var
i:longint;
begin
i:=next(x);
while i<>x do
begin
if jiuyuan(i,x)=false then
begin
if chupai(i,'K')=false then
begin
decblood(i);
if (i=) and (not a[x].tiaozhong) and (not a[x].tiaofan) then a[x].leifan:=true;
if a[i].blood= then kill(x,i);
end;
end;
i:=next(i);
end;
end; procedure wanjian(x:longint);
var
i:longint;
begin
i:=next(x);
while i<>x do
begin
if jiuyuan(i,x)=false then
begin
if chupai(i,'D')=false then
begin
decblood(i);
if (i=) and (not a[x].tiaozhong) and (not a[x].tiaofan) then a[x].leifan:=true;
if a[i].blood= then kill(x,i);
end;
end;
i:=next(i);
end;
end; procedure xingdong(x:longint);
var
i,k:longint;
begin
i:=;
with a[x] do
while i<=num do
begin
if a[x].blood= then exit;
if pai[i]='N' then
begin
delete(pai,i,num);
nanman(x);
i:=;
continue;
end;
if pai[i]='W' then
begin
delete(pai,i,num);
wanjian(x);
i:=;
continue;
end;
if (pai[i]='K') and ((not sha) or zhuge) then
begin
k:=next(x);
if diyi(x,k) then
begin
delete(pai,i,num);
tiao(x);
gongji(x,k);
sha:=true;
i:=;
continue;
end;
end;
if pai[i]='F' then
begin
k:=next(x);
if x= then
begin
while k<>x do
begin
if diyi(x,k) then
begin
delete(pai,i,num);
break;
end;
k:=next(k);
end;
if k<>x then
begin
fight(x,k);
i:=;
continue;
end;
end;
if shenfen='F' then
begin
delete(pai,i,num);
tiao(x);
fight(x,);
i:=;
continue;
end;
if shenfen='Z' then
begin
while k<>x do
begin
if diyi(x,k) then
begin
delete(pai,i,num);
break;
end;
k:=next(k);
end;
if k<>x then
begin
tiao(x);
fight(x,k);
i:=;
continue;
end;
end;
end;
if (pai[i]='P') and (blood<) then
begin
inc(blood);
delete(pai,i,num);
i:=;
continue;
end;
if pai[i]='Z' then
begin
zhuge:=true;
delete(pai,i,num);
i:=;
continue;
end;
inc(i);
end;
end; procedure work;
var
i:longint;
begin
i:=;
while true do
begin
i:=i mod n+;
if a[i].blood= then continue;
mopai(i);
mopai(i);
a[i].sha:=false;
xingdong(i);
end;
end; begin
init;
work;
end.

1972: [Sdoi2010]猪国杀 - BZOJ的更多相关文章

  1. [BZOJ 1972][Sdoi2010]猪国杀

    1972: [Sdoi2010]猪国杀 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 364  Solved: 204[Submit][Status][D ...

  2. Luogu2482 [SDOI2010]猪国杀 ---- 模拟

    Luogu2482 [SDOI2010]猪国杀 题意 ...... https://www.luogu.org/problemnew/show/P2482 总结 首先说一下代码的构思: 首先确定了所有 ...

  3. BZOJ1972:[SDOI2010]猪国杀

    我对模拟的理解:https://www.cnblogs.com/AKMer/p/9064018.html 题目传送门:https://www.lydsy.com/JudgeOnline/problem ...

  4. 洛谷 P2482 loj #2885 [SDOI2010]猪国杀 题解【模拟】【贪心】【搜索】

    好玩的模拟题. 以后要经常写模拟题鸭 题目描述 游戏背景 <猪国杀>是一种多猪牌类回合制游戏,一共有\(3\)种角色:主猪,忠猪,反猪.每局游戏主猪有且只有\(1\)只,忠猪和反猪可以有多 ...

  5. [洛谷P2482][SDOI2010]猪国杀

    题目大意:猪国杀,又一道大模拟题 题解:模拟,对于一个没有玩过三国杀的人来说,一堆细节不知道,写的十分吃力 卡点:无数,不想说什么了,这告诉我要多玩游戏 C++ Code: #include < ...

  6. 【BZOJ1972】[SDOI2010] 猪国杀(恶心的大模拟)

    点此看题面 大致题意: 让你模拟一个游戏猪国杀的过程. 几大坑点 对于这种模拟题,具体思路就不讲了,就说说有哪些坑点. 题面有锅,反猪是\(FP\). 数据有锅,牌堆中的牌可能不够用,牌堆为空之后需一 ...

  7. Bzoj1972: [Sdoi2010]猪国杀 题解(大模拟+耐心+细心)

    猪国杀 - 可读版本 https://mubu.com/doc/2707815814591da4 题目可真长,读题都要一个小时. 这道题很多人都说不可做,耗时间,代码量大,于是,本着不做死就不会死的精 ...

  8. 洛谷P2482 [SDOI2010]猪国杀——题解

    猪国杀,模拟题的一颗耀眼的明珠,成长大牛.锻炼码力必写题! 模拟题没什么思维难度.只要按部就班地去做就是.模拟简单在这,难也在这.因为题面巨长,条件巨多,忽疏一点都有可能全盘皆输.故推荐考试时碰见了, ...

  9. Luogu P2482 [SDOI2010]猪国杀

    这道题在模拟界地位不亚于Luogu P4604 [WC2017]挑战在卡常界的地位了吧. 早上到机房开始写,中间因为有模拟赛一直到1点过才正式开始码. 一边膜拜CXR dalao一边写到3点左右,然后 ...

随机推荐

  1. ASP、JSP、PHP 三种技术比较

    目前,最常用的三种动态网页语言有ASP(Active Server Pages),JSP(JavaServer Pages),PHP (Hypertext Preprocessor). 简 介 : A ...

  2. 《跨终端Web》读书笔记

    跨终端的Web成为了趋势,而这本书就是讲了在这种趋势下进行开发的常见问题及其解决方案,可能是限于篇幅,每个方面都没有展开细说,但这是这样让本书干货满满,几乎没有一句废话. 下面是一些笔记. Web的本 ...

  3. html5 之 canvas 相关知识(三)API-strokeStyle-shadow相关

    strokeStyle定义和用法 strokeStyle 属性设置或返回用于笔触的颜色.渐变或模式. context.strokeStyle=color|gradient|pattern;//指示绘图 ...

  4. 备忘====[HttpPost]和[AcceptVerbs(HttpVerbs.Post)]区别

    1.共同点:[HttpPost]和[AcceptVerbs(HttpVerbs.Post)]都是只接受POST请求过来的数据. 2.不同点:在MVC中如果想一个action既可以回应POST请求也可以 ...

  5. Ubuntu Linux 分区简易教程

    关于Linux系统下的“分区”问题,对于新手来说一直是很头疼的.我来简单写一下,它的“分区”方法,规则. 声明:我为了让没有接触过Linux系统的人,理解更加简单.所以在言语表述上不是很规范,专业.我 ...

  6. XMPP登录应用

    一.导入框架 1.XMMP框架,写入头文件,设置XMPPStreamDelegate代理,定义 XMPPStream *_xmppStream; 2.libresolv.dylib 3.libxml2 ...

  7. 洛谷 P1508 Likecloud-吃、吃、吃

    P1508 Likecloud-吃.吃.吃 题目提供者JosephZheng 标签 动态规划 难度 普及/提高- 题目背景 问世间,青春期为何物? 答曰:"甲亢,甲亢,再甲亢:挨饿,挨饿,再 ...

  8. 坑爹系列:sizeof运算符

    C语言里的sizeof关键字用于返回变量的类型宽度(变量所占的字节个数).例如: #include <stdio.h> int main() { int i = 0; int size = ...

  9. HTML5之图形变换

    - Transformations scale(0.5,0.5) 缩放 rotate(0.175) 旋转 translate(100,50) 位移 - 代码结构 context.scale(x, y) ...

  10. centos7搭建NIS与NFS综合应用

    实验环境: centos7(服务端)        redhat enterprise linux 7.2(客户端) 实验目的:用centos7的账号,能在redhat enterprise linu ...