【模拟】 ZOJ 3879 Capture the Flag
来源:互联网 发布:常用dhcp服务器软件 编辑:程序博客网 时间:2024/06/05 19:26
点击打开链接
模拟:
请仔细读题
队伍的某个服务器被攻击 会扣 n-1 分 分数分给攻击该服务器的队伍
若一个队的第i个服务器不能维持,则会扣去n-1分,分给其他第 i 个服务器还能维持的队伍
(每次checkpoint服务器状态都是1)
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <string>#include <queue>#include <cmath>;using namespace std;#define ll long longstruct node{ int id,rank; double fenshu;}man[1000];bool cmp0(node a,node b){ return a.fenshu>b.fenshu;}bool cmp1(node a,node b){ return a.id<b.id;}int n,q,s,c;int vis[105][105][105],visnum[105][105];int ser[106];int main(){ int t; cin>>t; while(t--) { cin>>n>>q>>s>>c; for(int i=1;i<=n;i++) { man[i].id=i; man[i].rank=1; man[i].fenshu=s; } int x; while(c--) { scanf("%d",&x); memset(vis,0,sizeof(vis)); memset(visnum,0,sizeof(visnum)); while(x--)//攻击 { int a,b,c; scanf("%d%d%d",&a,&b,&c); if(vis[a][b][c]) continue; vis[a][b][c]=1; visnum[b][c]++; } for(int i=1;i<=n;i++)//枚举人 { for(int k=1;k<=q;k++)//枚举服务器 { if(visnum[i][k]) { double d=1.0*(n-1.0)/visnum[i][k]; for(int j=1;j<=n;j++)//枚举攻击者 { if(vis[j][i][k]) { man[j].fenshu+=d; } } man[i].fenshu-=n-1; } } } // for(int i=1;i<=q;i++) { int ans=0; for(int j=1;j<=n;j++) { scanf("%d",&ser[j]); if(ser[j]==0) ans++; } if(ans==0) continue; //ans 表示 不能维持的个数 double c=ans*1.0*(n-1.0)/(n-ans); for(int j=1;j<=n;j++) { if(ser[j]==0) { man[j].fenshu-=n-1; } else man[j].fenshu+=c; } } sort(man+1,man+1+n,cmp0); man[1].rank=1; for(int i=2;i<=n;i++) { if(man[i-1].fenshu-man[i].fenshu<0.00001) man[i].rank=man[i-1].rank; else man[i].rank=i; } sort(man+1,man+1+n,cmp1); int x,b; scanf("%d",&x); for(int i=0;i<x;i++) { scanf("%d",&b); printf("%.8lf %d\n",man[b].fenshu,man[b].rank); } } } return 0;}/**/
0 0
- 【模拟】 ZOJ 3879 Capture the Flag
- ZOJ 3879 Capture the Flag(模拟)
- ZOJ 3879 Capture the Flag
- zoj 3879 Capture the Flag(长模拟)
- zoj 3879 Capture the Flag(模拟 数学)
- ZOJ-3879-Capture the Flag【模拟】【12th浙江省赛】
- ZOJ 2879 Capture the Flag (模拟题)
- ZOJ 3879 — Capture the Flag
- zoj Capture the Flag 比较难的模拟题
- ZOJ 3879 Capture the Flag (浙江省省赛K题+模拟)
- ZOJ - 3879 Capture the Flag (模拟)题意难懂的水题
- ZOJ3879:Capture the Flag(浙江省赛2015)
- Capture the Flag 浙江省赛K题
- The 2007 International Capture The Flag in UCSB
- 第十二届浙江省大学生程序设计大赛-Capture the Flag
- CTF入门指南1(Capture the flag)
- zoj Defuse the Bomb (模拟)
- ZOJ - 2971 Give Me the Number 模拟
- 追MM与23种设计模式
- AndroidのViewFlipper和ViewPager
- 对一个字符数组连续用gets函数出现的问题(缓冲区内容补充)
- 说说大型高并发高负载网站的系统架构(更新)
- Java关键字
- 【模拟】 ZOJ 3879 Capture the Flag
- 15第八周项目一——实现复数类中的运算符的重载(完整类)
- Java 理论和实践: 了解泛型
- easyui-editing datagrid 批量保存数据 二
- Python下用Tkinter进行GUI编程
- new delete
- 安卓面试题系列-2
- 最小编辑距离
- eclipse取消自动更新