题目太长,我只发链接吧

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. 修改ie版本的注册表webbroswer

    Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Exp ...

  2. jquery jsonp实现跨域

    html代码: $("#testJsonp").click(function(){ $.ajax({ url: "http://www.test.cc/1.php&quo ...

  3. 从零单排Linux – 2 – 目录权限

    从零单排Linux – 2 – 目录权限 1.sync 讲内存数据跟新到硬盘中 2.执行等级init a: run level 0:关机 b: run level 3:纯命令模式 c:run leve ...

  4. 【ROW_NUMBER 函数(Transact-SQL)】

    [ROW_NUMBER 函数(Transact-SQL)]返回结果集分区内行的序列号,每个分区的第一行从 1 开始. 注释: ROW_NUMBER() OVER (PARTITION BY COL1 ...

  5. 强大的数据恢复软件--EasyRecovery专业版

    EasyRecovery 是世界著名数据恢复公司 Ontrack 的技术杰作,它是一个威力非常强大的硬盘数据恢复工具.能够帮你恢复丢失的数据以及重建文件系统.EasyRecovery不会向你的原始驱动 ...

  6. win7下的mstsc ubuntu下的rdesktop

    远程图形化登录, win7下: 开始->mstsc->10.108.103.93即可进行后续输入账号密码验证登录. 功能类似rdesktop. 如图:

  7. iMAC——关闭自动弹出手机照片

    有时当自己的iPhone手机插入一台iMAC电脑时,会自动弹出自己iPhone手机的照片. 这相当影响人的隐私等等,所以顺便将方法(参考网络的)小记一篇博客. 一.OS X 10.10以上用户解决办法 ...

  8. UIPickerView常见属性、常见方法(包括代理方法和数据源方法)的一些说明

    一.UIPickerView 1.UIPickerView的常见属性 // 数据源(用来告诉UIPickerView有多少列多少行) @property(nonatomic,assign) id< ...

  9. jqGrid API 相关

    取消所有选中的行: $("jqgridtableid").trigger("reloadGrid"): 设定选中行,可设定多行选中: $("jqgri ...

  10. 暑假集训(4)第四弹 -----排列,计数(hdu1465)

    题意概括:嗯,纵使你数次帮助小A脱离困境,但上一次,小A终于还是失败了.那数年的奔波与心血,抵不过轻轻一指,便彻底 湮灭,多年的友谊终归走向末路.这一切重击把小A彻底击溃! 不为什么,你到底还是要继续 ...