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

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

于是就想贪心策略;

举了一个例子:

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. 关于JFace的自定义对话框(Dialog类)

    仅仅是使用MessageDialog,InputDialog等JFace中现成的对话框类是无法满足实际项目开发需要的. 很多时候都需要自己定制对话框,自定义对话框只要在Dialog类的基础上作扩展就行 ...

  2. Asp.net MVC 4 视图相关和其他

    @{ Layout = “…”} To define layout page Equivalent to asp.net master-page 要定义相当于ASP.NET母版页的页面布局 @mode ...

  3. wpf打印控件 实现分页打印控件功能

    因为 要实现打印 wpf  listbox控件  数据特别多 要打印在 几张纸上    找了几天 都没有找到相关的例子 现在 解决了 在这里和大家分享一下 public void print(Fram ...

  4. eclipse中启动Genymotion模拟器的错误

    错误程序: Output file: C:\Users\wishwzp\.genymotion-eclipse.logLoading Genymotion libraryGenymotion dire ...

  5. 处理不等高TableViewCell

    课题一:如何计算Cell高度 方案一:直接法(面向对象) 想知道妹纸爱你有多深?直接去问妹纸本人吧! 嗯!Cell也是一样的,想知道cell到底有多高?直接问Cell本人就好了.直接法,就是把数据布局 ...

  6. MarkDown中锚点的使用

    在文档中创建锚点: <A NAME="ROP_ON_ARM">Davi L, Dmitrienko A, Sadeghi A R, et al. [Return-ori ...

  7. Xcode中 xx duplicate symbols for architecture i386错误提示

    今天在编译iOS项目时Xcode报如下错误: ld: 15 duplicate symbols for architecture i386 clang: error:linker command fa ...

  8. C# 高精度求幂 poj1001

    高精度求幂 public static char[] exponentiation(string a,int r) { ]; string b = ""; string c = a ...

  9. 利用 css 制作简单的提示框

    在网页开发中,为了提高用户体验,经常会用到一些提示框来引导用户,这里分享下一些简单的提示框的制作 1.首先类似一个长方形右上角一个关闭按钮 这里用到的主要是一些定位的知识,运用relative和abs ...

  10. Linux之在CentOS上一次艰难的木马查杀过程

    今天朋友说他一台要准备上线的生产服务器被挂马,特征ps命令找不到进程,top能看到负载最高的一个程序是一个随机的10位字母的东西,kill掉之后自动再次出现一个随机10位字母的进程. 我让他关闭这个机 ...