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中,虽然不需要程序员手动去管理对象的生命周期,但是如果希望某些对象具备一定的生命周期的话(比如内存不足时JVM就会自动回收某些对象从而避免OutOfMemory的错误)就需要用到软引用和弱引 ...

  2. 基于Selenium2+Java的UI自动化(2) - 启动浏览器

    一.准备工作 我们常用的浏览器主要有三个:chrome.Firefox.IE:其中chrome 和 IE 需要下载驱动程序,才能启动浏览器,注意驱动程序有32位和64位两种. 另外:如何查看本机的浏览 ...

  3. List中的get(i)

    List中的get(i)方法是获取List中的第i个对象吗 是第i+1个对象.List是从0开始的 List是有序的可重复的集合接口

  4. 使用 Spring 2.5 基于注解驱动的 Spring MVC

    http://www.ibm.com/developerworks/cn/java/j-lo-spring25-mvc/ 概述 继 Spring 2.0 对 Spring MVC 进行重大升级后,Sp ...

  5. 浅析foreach原理

    在日常开发工作中,我们发现很多对象都能通过foreach来遍历,比如HashTable.Dictionary.数组等数据类型.那为何这些对象能通过foreach来遍历呢?如果写一个普通的Person类 ...

  6. Swift学习的新工具---REPL

    从xcode6.1开始,苹果官方提供了一个新的辅助开发swift的工具,即repl(read eval print loop) OS X Yosemite系统下,打开终端应用程序,输入swift: 如 ...

  7. SQL SERVER 级联删除

    有三个表: Company Address Contact 在Address和Contact中建立外键,外键id为company的id, 那么就不能任意删除Company.但假如在外键约束中把级联删除 ...

  8. javascript 第28节 jQuery事件、迭代、样式

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. [翻译][MVC 5 + EF 6] 10:处理并发

    原文:Handling Concurrency with the Entity Framework 6 in an ASP.NET MVC 5 Application 1.并发冲突: 当一个用户编辑一 ...

  10. SSH+Ajax实现用户名重复检查(二)

    1.另外一种更常用的js表达方式: var user = { inintEvent: function(){ $("input[name='user.User_LogName']" ...