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. Java接口的表现形式

    一.概念理解 Java接口是一些方法特征的集合,并没有方法的具体实现,类似于电源插座,可以充不同类型的电器,但是必须适配特定的接口规范.接口是抽象化的,所以其不能被实例化的(不能有构造函数,创建对象) ...

  2. HW--字符串加解密

    package t0817; import java.util.Scanner; public class StringEncrypt { public static void main(String ...

  3. C 中随机数

    C语言,如何产生随机数: 基本函数 在C中取随机数所需要对函数是: int rand ( void ); void srand ( unsigned int n); 备注:必须包含该头文件#inclu ...

  4. sqlserver的增删改查

    select*from shuiguo  查询表 且小于等于7的范围) select distinct name from shuiguo--去除重复,只针对一列 select * from shui ...

  5. UISearchController的使用。(iOS8+)

    这种方法早就发现了,不过一致没用,今天拿过来用,发现了一些问题. 1.这个东西和表视图结合使用很方便,首先,创建新的工程,将表视图控制器作为工程的根视图,并且添加一个导航(当然,你可以不这样做,但是你 ...

  6. JavaScript基础-面向对象编程<1>

    1.1 函数与对象  1.定义函数的方式定义类 定义类的方法: function class1(){ //类成员的定义及构造函数部分 } class1既是一个函数,也是一个类. 使用 new 操作符获 ...

  7. Java语言----三种循环语句的区别

    ------- android培训.java培训.期待与您交流! ---------- 第一种:for循环 循环结构for语句的格式:       for(初始化表达式;条件表达式;循环后的操作表达式 ...

  8. CruiseControl.NET : svnrevisionlabeller

    How to use svnrevisionlabeller as your labeller type in CC.NET: 1. Download ccnet.SvnRevisionLabelle ...

  9. leetcode problem 37 -- Sudoku Solver

    解决数独 Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated ...

  10. C# IO流的操作

    C# IO流的操作非常重要,我们读写文件都会使用到这个技术,这里先演示一个文件内容复制的例子,简要说明C#中的IO操作. namespace ConsoleApplication1 { class P ...