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点左右,然后 ...
随机推荐
- saltstack实战3--配置管理之grains
grains是什么 grains是minion服务启动后,采集的客户端的一些基本信息,硬件信息,软件信息,网络信息,软件版本等.你可以在minion上自定义一些grains信息. 它是静态的信息,mi ...
- 上传系列:jquery.upload.js
最近想做一个上传的总结,把自己用过的上传插件都写一写,哪天用到的时候就不用再一次的翻阅资料,现在页面上用到的上传插件,原理上都差不多,那我也就不再废话了,下面我主要记录一下几个比较常用的,由简到繁,这 ...
- JQGrid各种参数详解API(转载)
下面是转自其他人blog的一个学习资料,与其说是学习资料,说成查询帮助文档更加合适. jqGrid学习之 ------------- 安装 jqGrid安装很简单,只需把相应的css.js文件加入到页 ...
- Linux下c基于openssl生成MD5的函数
Linux下openssl提供了一系列哈希及加密的函数,如果调用openssl提供的MD5函数生成任意字符串的MD5呢?下面提供了一段代码实现Linux下c字符串生成md5的函数. 具体代码: 1 2 ...
- python字符串操作2
在python有各种各样的string操作函数.在历史上string类在python中经历了一段轮回的历史.在最开始的时候,python有一个专 门的string的module,要使用string的方 ...
- Quartz 第五课 SimpleTriggers 官方文档翻译
对于SimpleTrigger你需要知道它的启动总是在一个特殊的时间点或者有你设置的重复时间段中.直白来说,如果你想在2005年1月13日,正好上午11时23分54秒触发,然后执行五次,每十秒钟. 从 ...
- Linux下Tomcat启动正常,但浏览器无法访问
1.服务器可ping通 2.服务器抓本地的http请求包,可以抓到 3.本地抓服务器返回的http响应包,抓不到 经过查找,是由于开启了Linux防火墙 查看防火墙配置(需要root权限) [root ...
- CSS笔记---文字两边对齐
<style> .box{ width: 1000px; height: 500px; background-color: #aa0000; margin:0 auto; } .teste ...
- 插件笔记——dataTables使用说明
jquery DataTables中文使用说明 出处:http://blog.vunso.com/201405/jquery-datatables%E4%B8%AD%E6%96%87%E4%BD%BF ...
- 引用、return
C语言中没有引用,引用(reference)是c++对c语言的重要扩充.通俗点说,引用就是“起别名”.比如变量data,和它的引用 RefData.虽然名字不同,但是操作他们的时候,都操作的是相同的内 ...