1972: [Sdoi2010]猪国杀 - BZOJ
题目太长,我只发链接吧
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的更多相关文章
- [BZOJ 1972][Sdoi2010]猪国杀
1972: [Sdoi2010]猪国杀 Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 364 Solved: 204[Submit][Status][D ...
- Luogu2482 [SDOI2010]猪国杀 ---- 模拟
Luogu2482 [SDOI2010]猪国杀 题意 ...... https://www.luogu.org/problemnew/show/P2482 总结 首先说一下代码的构思: 首先确定了所有 ...
- BZOJ1972:[SDOI2010]猪国杀
我对模拟的理解:https://www.cnblogs.com/AKMer/p/9064018.html 题目传送门:https://www.lydsy.com/JudgeOnline/problem ...
- 洛谷 P2482 loj #2885 [SDOI2010]猪国杀 题解【模拟】【贪心】【搜索】
好玩的模拟题. 以后要经常写模拟题鸭 题目描述 游戏背景 <猪国杀>是一种多猪牌类回合制游戏,一共有\(3\)种角色:主猪,忠猪,反猪.每局游戏主猪有且只有\(1\)只,忠猪和反猪可以有多 ...
- [洛谷P2482][SDOI2010]猪国杀
题目大意:猪国杀,又一道大模拟题 题解:模拟,对于一个没有玩过三国杀的人来说,一堆细节不知道,写的十分吃力 卡点:无数,不想说什么了,这告诉我要多玩游戏 C++ Code: #include < ...
- 【BZOJ1972】[SDOI2010] 猪国杀(恶心的大模拟)
点此看题面 大致题意: 让你模拟一个游戏猪国杀的过程. 几大坑点 对于这种模拟题,具体思路就不讲了,就说说有哪些坑点. 题面有锅,反猪是\(FP\). 数据有锅,牌堆中的牌可能不够用,牌堆为空之后需一 ...
- Bzoj1972: [Sdoi2010]猪国杀 题解(大模拟+耐心+细心)
猪国杀 - 可读版本 https://mubu.com/doc/2707815814591da4 题目可真长,读题都要一个小时. 这道题很多人都说不可做,耗时间,代码量大,于是,本着不做死就不会死的精 ...
- 洛谷P2482 [SDOI2010]猪国杀——题解
猪国杀,模拟题的一颗耀眼的明珠,成长大牛.锻炼码力必写题! 模拟题没什么思维难度.只要按部就班地去做就是.模拟简单在这,难也在这.因为题面巨长,条件巨多,忽疏一点都有可能全盘皆输.故推荐考试时碰见了, ...
- Luogu P2482 [SDOI2010]猪国杀
这道题在模拟界地位不亚于Luogu P4604 [WC2017]挑战在卡常界的地位了吧. 早上到机房开始写,中间因为有模拟赛一直到1点过才正式开始码. 一边膜拜CXR dalao一边写到3点左右,然后 ...
随机推荐
- Sharepoint 列表
1.将SharePoint 2010列表数据使用Access打开 在SharePoint 2010新增加了对列表在Access客户端的打开,可以在Microsoft Access 中处理列表中的项目, ...
- WDatePicker 屏蔽onchange事件的解决办法
受下面文章的启发,使用DatePicker自带的年月日相关的change事件,可以“勉强”实现input控件的onchange(),直接上代码: 1.第一种方式:利用DatePicker提供的年.月. ...
- Linux文件系统结构
准备写个Linux基础知识总结, 第一个想到的就是整理一个常用系统文件夹结构的说明,园子里“Aric小屋”的结构图整理的不错,我就不重复整理了,故借用一下
- sql语句聚合等疑难问题收集
------------------------------------------------------------------------------------ 除法运算 select 500 ...
- 事件[event]_C#
事件(event): 1. 事件是类在发生其关注的事情时用来提供通知的方式.例如,封装用户界面控件的类可以定义一个在单击该控件时发生的事件.控件类不关心单击按钮时发生了什么,但它需要告知派 ...
- 项目中的那些事---JavaScript
一.String.charAt(index) 作用:获取字符串指定索引位置的字符 注意:index的值是0~(字符串长度-1)之间的值 <script type="text/javas ...
- SEO前端优化
精减代码 清除网页中一些冗余的代码,网上有这样的工具,可以辅助完成,如果需要的话,我们可以把代码中的注释去掉,甚至空行之类的也去掉,尽量的减少代码量,从而减小页面体积. CSS Sprites 通俗点 ...
- UVaLive6834 Shopping
题意:一条直线上有n个点,标号从1到n,起点为0,终点为N+1,给定m个限制关系(ci,di),访问ci点前必须先访问di点,每两个点之间是单位距离,求在限制条件下,从起点到终点访问完所有的点的最短距 ...
- Qt学习总结-ui篇(二)
qccs定义圆角 border-radius:10px; 如果想给特定位置定义圆角,如: 左上角:border-left-top-radius:10px; 右下角色:border-right-bo ...
- 印象笔记无法同步问题解决 Unable to send HTTP request: 12029
问题 今天突然发现本地软件不能访问网络. 包括: 印象笔记无法同步, 搜狗输入法无法登陆. 但其它上网正常. 思路及解决过程 因为chrome上网 ,qq上网均正常. 且同事可以正常使用. 推测是本地 ...