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点左右,然后 ...
随机推荐
- cogs 餐巾 461(贪心)
/*虽然这暴力剪了又剪 改了又改 还是初始的20分...*/ #include<iostream> #include<cstdio> #include<cstring&g ...
- 【转】六年软件测试感悟-从博彦到VMware
不知不觉已经从事软件测试六年了,2006毕业到进入外包公司外包给微软做软件测试, 到现在加入著名的外企.六年的时间过得真快. 长期的测试工作也让我对软件测试有了比较深入的认识.但是我至今还是一个底层的 ...
- ubuntu(16.04.01)学习-day2--高级命令
1.查找命令 find -name "hello.c" grep "test" grep "usb" -c -r /drivers/usb ...
- jQuery中ajax应用
一:Ajax介绍 1.ajax的定义:客服端js所发起的http请求的代号,无刷新的数据更新. 2.ajax原理: 运用XHTML+CSS来表达信息,运用javascript操作DOM(Documen ...
- SQL Server 中WITH (NOLOCK)浅析(转潇湘隐者)
博文出处:http://www.cnblogs.com/kerrycode/p/3946268.html 概念介绍 开发人员喜欢在SQL脚本中使用WITH(NOLOCK), WITH(NOLOCK)其 ...
- Android应用资源--之属性(Attribute)资源
原文链接: http://wujiandong.iteye.com/blog/1184921 属性(Attribute)资源:属于整个Android应用资源的一部分.其实就是网上一堆介绍怎么给自定义V ...
- 免费的HTML5连载来了《HTML5网页开发实例详解》连载(五)图解通过Fiddler加速开发
Fiddler是Windows底下最强大的请求代理调试工具,监控任何浏览器的HTTP/HTTPS流量,窜改客户端请求和服务器响应,解密HTTPS Web会话,图4.44为Fiddler原理示意图. 图 ...
- 使用JavaScript实现简单的输入校验
HTML页面代码: <!doctype html> <html lang="en"> <head> <meta charset=" ...
- 数据库(MSSQLServer,Oracle,DB2,MySql)常见语句以及问题
创建数据库表 create table person ( FName varchar(), FAge int, FRemark varchar(), primary key(FName) ) 基本sq ...
- PHP服务器负载判断
<?php header("content-type:text/html;charset=utf-8"); // echo PHP_OS;exit; // echo get_ ...