ZOJ 3757 Alice and Bob and Cue Sports(模拟题)
来源:互联网 发布:宅男软件 编辑:程序博客网 时间:2024/06/10 03:23
Description
Alice and Bob both love playing games. Now, Alice and Bob are playing a cue sport like Nine-ball Pool. Two players move in turn. A move is that one player use the cue ball to hit the target ball for pocketing the target ball. At the beginning of game, there are one cue ball and n object balls. Each object ball has a number (a positive integer) on it, and no two object balls have the same number. In a move, the target ball is a object ball still on the table with the smallest number. If the player does the following things in a move, a foul is called and a penalty point is added to the opposite's point:
- Cue ball do not hit any object ball. Penalty: the number of target ball.
- Cue ball is not pocketed and hit at least one ball, but do not hit target ball first or hit more than one object ball first at the same time. Penalty: the largest number of ball in the first hit balls.
- Cue ball is pocketed and hit at least one ball. Penalty: the largest number of ball in the first hit balls.
Now given n object balls and m moves, Bob wants to write a program to calculate the final points of Alice and him after these m moves. Because of Lady's first Rule, Alice always moves first.
Input
There are multiple cases. The first line of each case consists of two integers, n and m (1 ≤ n ≤ 1000, 0 ≤ m ≤ 1000), as described above. The second line consists of n positive integers. Each integer ai means the number of ith object ball (1 ≤ ai ≤ 10000). There are 2m lines followed. The (2i-1)th and (2i)th lines describe the ith move. The (2i-1)th line first includes an integer p, meaning cue ball hits p balls first. There are p integers followed in the same line, describing the hit balls. The (2i)th line first includes an integer q, meaning there are q balls pocketed. There are q integers followed in the same line, describing the pocketed balls (0 means cue ball). It's guaranteed that there is no impossible data.
Output
For each case, output one line as the format: "AP : BP", where AP means Alice's points and BP means Bob's points.
Sample Input
3 32 3 51 21 21 31 51 31 3
Sample Output
2 : 8
题意:打桌球,按规则罚分,尼玛啊,模拟题就算了吧,还要是题意题,犯规之后除了罚那些分,还要罚全部进球的分啊,你妹啊
题解:就是一个大模拟题啊。。。尼玛啊,浪费时间啊,题意原来都没懂啊,可以不坑我吗啊,看别人代码才知道看错题意啊
(仅以此文纪念浪费的时间和逝去的码力和死去的脑细胞啊)
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int a[1008],b[1008],c[1008],mark[1008],res[2];int main(){ int n,m,i,j,k,now,x,y,temp,flag,flag2; while(~scanf("%d%d",&n,&m)) { for(i=0; i<n; i++) scanf("%d",a+i); sort(a,a+n); res[0]=res[1]=0; for(now=k=0; k<m; k++) { scanf("%d",&x); for(i=0; i<x; i++) scanf("%d",b+i); scanf("%d",&y); for(i=0; i<y; i++) scanf("%d",c+i); flag2=0; if(!x) { res[!now]+=a[0]; } else { for(flag=i=0; i<y; i++) if(c[i]==0) { flag=1; break; } if(flag) { for(temp=i=0; i<x; i++) if(b[i]>temp) temp=b[i]; res[!now]+=temp; } else { if(x>1) { for(temp=i=0; i<x; i++) if(b[i]>temp) temp=b[i]; res[!now]+=temp; } else { if(b[0]!=a[0]) { for(temp=i=0; i<x; i++) if(b[i]>temp) temp=b[i]; res[!now]+=temp; } else { for(i=0; i<y; i++) if(c[i]==a[0]) { flag2=1; break; } } } } } if(flag2) { for(i=0; i<y; i++) res[now]+=c[i]; } else { now=!now; for(i=0; i<y; i++) res[now]+=c[i]; } memset(mark,0,sizeof(mark)); for(i=0; i<y; i++) { if(c[i]==0) continue; for(j=0; j<n; j++) if(a[j]==c[i]) { mark[j]=1; break; } } for(i=j=0; i<n; i++) { if(mark[i]) continue; a[j++]=a[i]; } n=j; } printf("%d : %d\n",res[0],res[1]); } return 0;}
- zoj 3757 Alice and Bob and Cue Sports 模拟
- ZOJ 3757 Alice and Bob and Cue Sports [模拟]
- ZOJ 3757 Alice and Bob and Cue Sports(模拟题)
- zoj 3757 Alice and Bob and Cue Sports
- zoj 3757 Alice and Bob and Cue Sports
- ZOJ 3757 Alice and Bob and Cue Sports
- ZOJ3757:Alice and Bob and Cue Sports(模拟)
- ZOJ 3666 Alice and Bob(博弈)
- ZOJ 3666 Alice and Bob(博弈 sg 函数入门)
- ZOJ Problem Set - 3655 Alice and Bob
- zoj 3666 Alice and Bob , SG函数
- ZOJ 3666 Alice and Bob 基础博弈
- Alice and Bob(长春)
- SDUT2608(Alice and Bob)
- Alice and Bob(博弈)
- BJ模拟(1) D2T2 Alice and Bob IV
- Alice and Bob
- 2683. Alice and Bob
- Java中的静态变量和静态函数
- Restlet - 基于Spring的Restlet开发实例
- IE6下的最小高度问题
- ZOJ 1003 Crashing Balloon(DFS)
- Android 动态设置全屏,退出全屏
- ZOJ 3757 Alice and Bob and Cue Sports(模拟题)
- 逻辑地址、线性地址、物理地址
- 野指针的成因与避免方法
- 第四周作业-键盘输入数据 和 数据类型
- PICT:基于正交法的软件测试用例生成工具
- 【取巧遍历】#7 A. Kalevitch and Chess
- android lint工具的使用
- 内部排序总结
- sax解析xml文件实例一(注意endElement 内部最后 currentTag=null)