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

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

于是就想贪心策略;

举了一个例子:

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. 一致性Hash算法及使用场景

    一.问题产生背景      在使用分布式对数据进行存储时,经常会碰到需要新增节点来满足业务快速增长的需求.然而在新增节点时,如果处理不善会导致所有的数据重新分片,这对于某些系统来说可能是灾难性的. 那 ...

  2. WordPress 后台提示输入FTP信息

    Wordpress 安裝主題時,需要輸入ftp訊息 參考了:WordPress后台更新提示输入FTP信息 ,解決方法是: 方法一.通過ssh 對wordpress 項目的文件夾賦權限 sudo cho ...

  3. MidPayinfoVO

    package nc.vo.arap.payablebill; import nc.vo.pub.SuperVO; import nc.vo.pub.lang.UFDate; import nc.vo ...

  4. HTML——<meta http-equiv="content-type" content="text/html; charset=UTF-8">

    没有添加这句话的编码方式的话,很容易就乱码了 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&g ...

  5. IIS6.0、IIS7中的站点、应用程序和虚拟目录详细介绍

    这里说的不是如何解决路径重写或者如何配置的问题,而是阐述一下站点(site),应用程序(application)和虚拟目录 (virtual directory)概念与作用,已及这三个东西在IIS6与 ...

  6. swift-计算器(斯坦福公开课)

    看了斯坦福老头的课,真心觉得,我的中文怎么也变的这么垃圾了.是关于iOS8的课程,用swift写的,一个计算器应用的制作,看看人家的课,再看看咱们学校的课(不过垃圾学校,纯粹觉得大学浪费了),废话啊, ...

  7. 关于Asp.Net Forms身份认证

    Asp.Net管道式的构建个我们提供了通过IHttpMoudle来订阅管线事件来达到干预HTTP请求的目的,Asp.Net的身份认证正是通过此种方式来对请求来执行身份认证的,这篇文章仅仅谈论Forms ...

  8. oc 基础知识

    一.枚举 结构体 typedef enum{ sexMan, sexWoman }Sex;   tydedef struct{    int year;    int month;    int da ...

  9. 手把手教你写电商爬虫-第三课 实战尚妆网AJAX请求处理和内容提取

    版权声明:本文为博主原创文章,未经博主允许不得转载. 系列教程: 手把手教你写电商爬虫-第一课 找个软柿子捏捏 手把手教你写电商爬虫-第二课 实战尚妆网分页商品采集爬虫 看完两篇,相信大家已经从开始的 ...

  10. Java线程练习

    /*线程练习创建两个线程,与主线程交替运行 */ class Text extends Thread{    private String name;    Text(String name)     ...