3757一个模拟题,简单,但容易错;

3758 大素数判定就行;

#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 100009
using namespace std; int ans[];
int hit[maxn];
int in[maxn];
int ball[maxn];
bool vis[maxn]; int main()
{
int n,m;
int p,q;
while(scanf("%d%d",&n,&m)!=EOF)
{
ans[]=;
ans[]=;
memset(vis,,sizeof vis);
for(int i=; i<n; i++)
scanf("%d",&ball[i]);
sort(ball,ball+n);
int ma1=-;
int sumofin=;
int tar=;
int turn=;
for(int i=; i<m; i++)
{
bool flag1=,flag2=,flag3=;
for(tar; tar<n; tar++)
if(vis[ball[tar]]==)
break;
ma1=;
sumofin=;
scanf("%d",&p);
for(int i=; i<p; i++)
{
scanf("%d",&hit[i]);
if(hit[i]>ma1)ma1=hit[i];
if(hit[i]==ball[tar]&&p==) flag1=;//只击中目标球;
}
scanf("%d",&q);
for(int i=; i<q; i++)
{
scanf("%d",&in[i]);
sumofin+=in[i];
vis[in[i]]=;
if(in[i]==ball[tar])flag2=;//目标球进了;
if(in[i]==)flag3=;//白球进了;
}
if(p==)
{
turn=-turn;
ans[turn]+=ball[tar];
}
else
{
if(flag3==&&flag1==)
{
turn=-turn;
ans[turn]+=ma1;
ans[turn]+=sumofin;
}
else if(flag3&&p)
{
turn=-turn;
ans[turn]+=ma1;
ans[turn]+=sumofin;
}
else if(flag2==)
{
turn=-turn;
ans[turn]+=sumofin;
}
else
{
ans[turn]+=sumofin;
}
}
}
printf("%d : %d\n",ans[],ans[]);
}
return ;
}

zoj 3757&&3758的更多相关文章

  1. zoj 3757 Alice and Bob and Cue Sports 模拟

    题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3757 #include<cstdio> #incl ...

  2. zoj 3757 Alice and Bob and Cue Sports 月赛A 模拟

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3757 题意:根据所给的台球规则,按照每次的结果计算最终两人的得分 ...

  3. ZOJ 3757 Alice and Bob and Cue Sports(模拟)

    题目链接 题意 : 玩台球.Alice 和 Bob,一共可以进行m次,Alice 先打.有一个白球和n个标有不同标号的球,称目标球为当前在桌子上的除了白球以外的数值最小的球,默认白球的标号为0.如果白 ...

  4. ZOJ 3757 Alice and Bod 模拟

    上次的ZJU月赛题,规则比较复杂,当时就连题意都没摸清楚,只觉得非常复杂 比完后敲啊敲啊敲,连续WA啊,该反思下自己,没按照题意来设置条件,题目中说了 白球入袋并且... 给对手加分 ,白球未入袋并且 ...

  5. Hsql中In没有1000的限制

    SELECT * FROM user , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ...

  6. jqu

    1 /*2 * 说明:3 * 本源代码的中文注释乃Auscarlin呕心沥血所作.旨在促进jQuery的传播以及向广大jQuery爱好者提供一个进阶4 *的途径,以让各位更加深入地了解jQuery,学 ...

  7. 游戏中的自动寻路-A*算法(第一版优化——走斜线篇)

    一.简述以及地图 G 表示从起点移动到网格上指定方格的移动距离 (暂时不考虑沿斜向移动,只考虑上下左右移动). H 表示从指定的方格移动到终点的预计移动距离,只计算直线距离,走直角篇走的是直角路线. ...

  8. ZOJ Problem Set - 3758 素数

    Singles' Day Time Limit: 2 Seconds Memory Limit: 65536 KB Singles' Day(or One's Day), an unofficial ...

  9. zoj 3758 Singles' Day

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5203 题意:有n个1然后按照b进制转化为10进制数,判断这个数是不是素数. # ...

随机推荐

  1. android小结

    一. 对与java读写文件的操作: 字节流: //filename  可以是文件名,可以是文件路径 FileOutputStream outputStream=new FileOutputStream ...

  2. SWT中的布局之-----FormLayout(表格式布局)

    表格式(FormLayout类) 表格式布局管理器,通过创建组件各个边的距离来布局组件,和GridLayout一样强大. 用GridLayout与FormLayout都可以实现相同的界面效果,但有时使 ...

  3. 2013 ACM/ICPC 长沙现场赛 A题 - Alice's Print Service (ZOJ 3726)

    Alice's Print Service Time Limit: 2 Seconds      Memory Limit: 65536 KB Alice is providing print ser ...

  4. Hive over HBase和Hive over HDFS性能比较分析

    http://superlxw1234.iteye.com/blog/2008274 环境配置: hadoop-2.0.0-cdh4.3.0 (4 nodes, 24G mem/node) hbase ...

  5. Dremel made simple with Parquet

    http://lastorder.me/tag/parquet.html https://blog.twitter.com/2013/dremel-made-simple-with-parquet 对 ...

  6. rs.open sql,conn,3,1中3,1代表什么

    RecordSet中的open完全的语法是 SecordSet.Open Source,ActiveConnection,CursorType,LockType,Options 例如: rs.open ...

  7. Asp.net MVC 4 Attributes特性

    Attributes特性 ActionFilterAttribute Represents the base class for filter attributes. 代表筛选器属性的基类. Acti ...

  8. 重大发现Android studio 如何简单快速修改package name

    好多人都发现Android studio修改包名比较麻烦,只能一级一级的修改,今天偶尔发现了一个快捷方法. 废话不多说: 1 打开项目的AndroidManifest.xml文件 2 鼠标光笔定位到你 ...

  9. c#局域网文件搬移

    /// kongxiang--2013.7.23 /// using System;using System.Collections.Generic;using System.Linq;using S ...

  10. 40个Java集合面试问题和答案【下】【转载】

    接上文:http://www.cnblogs.com/xujianbo/p/5148083.html 28.哪些集合类是线程安全的? Vector.HashTable.Properties和Stack ...