刚刚看到这个题感觉是博弈题;

不过有感觉不像,应该是个贪心;

于是就想贪心策略;

举了一个例子:

3

3 1 2 3

4 3 4 1 2

5 4 1 2 5 8

如果他们两个每次都拿对自己最有利的那个的话,C的得分是14分;

但是C作为第一个选手,他有更好的策略,只拿前一半,后一半给J,中间的再分;这样的话C的得分就能达到15分;

同样J也有这样的策略,他也能保证自己最少能拿到后一半的分(跟风式的拿);

这样的话,贪心策略就明朗了!

#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 105
using namespace std; int s[maxn];
int c,j;
int main()
{
int n,num;
int t,cnt=;
scanf("%d",&n);
for(int i=; i<n; i++)
{
scanf("%d",&t);
for(int k=; k<t/; k++)
{
scanf("%d",&num);
c+=num;
}
if(t&)
{
scanf("%d",&s[cnt]);
cnt++;
}
for(int k=; k<t/; k++)
{
scanf("%d",&num);
j+=num;
}
}
sort(s,s+cnt);
bool flag=;
for(int i=cnt-; i>=; i--)
{
if(flag)
c+=s[i];
else
j+=s[i];
flag=!flag;
}
printf("%d %d",c,j);
return ;
}

codeforces 388C Fox and Card Game的更多相关文章

  1. Codeforces 388C Fox and Card Game (贪心博弈)

    Codeforces Round #228 (Div. 1) 题目链接:C. Fox and Card Game Fox Ciel is playing a card game with her fr ...

  2. Codeforces Round #228 (Div. 1) C. Fox and Card Game 博弈

    C. Fox and Card Game 题目连接: http://codeforces.com/contest/388/problem/C Description Fox Ciel is playi ...

  3. CodeForces 462B Appleman and Card Game(贪心)

    题目链接:http://codeforces.com/problemset/problem/462/B Appleman has n cards. Each card has an uppercase ...

  4. CodeForces - 512B Fox And Jumping[map优化dp]

    B. Fox And Jumping time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. CodeForces 388A Fox and Box Accumulation (模拟)

    A. Fox and Box Accumulation time limit per test:1 second memory limit per test:256 megabytes Fox Cie ...

  6. codeforces 510B. Fox And Two Dots 解题报告

    题目链接:http://codeforces.com/problemset/problem/510/B 题目意思:给出 n 行 m 列只有大写字母组成的字符串.问具有相同字母的能否组成一个环. 很容易 ...

  7. cf E. Fox and Card Game

    http://codeforces.com/contest/389/problem/E 题意:给你n个序列,然后两个人x,y,两个人玩游戏,x从序列的前面取,y从序列的后面取,两个人都想自己得到的数的 ...

  8. Codeforces 388A - Fox and Box Accumulation

    388A - Fox and Box Accumulation 思路: 从小到大贪心模拟. 代码: #include<bits/stdc++.h> using namespace std; ...

  9. CodeForces - 510B Fox And Two Dots (bfs或dfs)

    B. Fox And Two Dots time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

随机推荐

  1. Atom编辑器入门到精通(六) Markdown支持

    尽管我们使用Atom主要是为了编写代码,不过Atom还支持编辑很多其他格式的文件. 比如Markdown和Asciidoc. 这一章中我们主要学习如何快速方便地编辑Markdown文件.另外在写这篇博 ...

  2. java和html的区别

    Java 不是一门程序语言,它是一个平台,也可以说是一门技术. Java 包括 1.Java 程式语言 一个类似 C++ 或 Smalltalk 的物件导向程式语言.学习 Java 程式语言类似学人类 ...

  3. ACM——Digital Roots

    http://acm.njupt.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1028 Digital Roots 时间 ...

  4. sqlserver的增删改查

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

  5. Linux中Oracle数据库备份还原

    一.备份Oracle数据库 1.使用数据库管理员账户登录 sqlplus system/system@orcl as sysdba; 2.创建备份目录,并指定备份目录(bak_dir)的物理路径 cr ...

  6. Jquery on 事件

    $(document).on("click", 'a.AAA', function(){ var flag=$(this).attr('flag'); alert(flag); } ...

  7. 第五篇、常用的SQL语句和函数介绍

    简介: 在使用到sqlite3的时候,常常需要写一些SQL语句,现将常用到的部分语句稍微总结以下,由于个人习惯,关键字用大写. 附: /*简单约束*/ CREATE TABLE IF NOT EXIS ...

  8. 鸟哥笔记:linux系统日志文件介绍

    简单的说日志文件就是记录系统活动信息的几个文件,例如:何时.何地(来源ip).何人(什么服务名称).做了什么操作.换句话说就是:记录系统在什么时候由哪个进程做了什么样的行为时,发生了什么事件等. 日志 ...

  9. jquery 100%全屏自适应宽可点击左右和焦点的自动切换幻灯片特效

    http://www.divcss5.com/css-texiao/texiao717.shtml http://d.divcss5.com/divcss5/down/2014062201.zip

  10. GroupBox 重绘圆角边框和文字

    private void GroupBox_Paint(object sender, PaintEventArgs e) { if (sender != null && sender ...