题目链接

题意:给定一个数组记录两队之间分差,只记分差,不记谁高谁低,问最终有多少种比分的可能性

分析:

类似cf的题目,比赛的时候都没想出来,简直笨到极点。。。。。

最后的差确定,只需要计算和的种类,有多少种就是多少。

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
#define LL __int64
const int maxn = +;
using namespace std;
int a[maxn]; int main()
{
int i, t, n, ca = , ans, f;
scanf("%d", &t);
while(t--)
{
ans = ; f = ;
scanf("%d", &n);
for(i = ; i <= n; i++)
{
scanf("%d", &a[i]);
if(i>=)
{
if(a[i-]== && a[i]==)
ans ++;
if(a[i-]== && a[i]==)
ans ++;
if(a[i-]==a[i] && a[i]!=) //这两种都是不符合规则的
f = ;
if(abs(a[i]-a[i-])>)
f = ;
}
}
if(f)
printf("Case #%d: 0\n", ca++); //不存在的情况
else if(a[n]==)
printf("Case #%d: %d\n", ca++, ans+); //最后分差为0,结果少了一半
else
printf("Case #%d: %d\n", ca++, *ans+);
}
return ;
}

hdu 4972 A simple dynamic programming problem (转化 乱搞 思维题) 2014多校10的更多相关文章

  1. hdu 4972 A simple dynamic programming problem(高效)

    pid=4972" target="_blank" style="">题目链接:hdu 4972 A simple dynamic progra ...

  2. 2014多校第十场1002 || HDU 4972 A simple dynamic programming problem

    题目链接 题意 : 每次无论哪个队投进一个篮球,就记下现在两队比分的差值,问你最后的结果有多少种情况. 思路 : 该题实在是不好理解,最后的结果有多少种情况就是说不管中间过程怎么来的,只要最后结果不一 ...

  3. 【HDOJ】4972 A simple dynamic programming problem

    水题. #include <cstdio> #include <cstring> #include <cstdlib> int abs(int x) { ? -x: ...

  4. HDU-4972 A simple dynamic programming problem

    http://acm.hdu.edu.cn/showproblem.php?pid=4972 ++和+1还是有区别的,不可大意. A simple dynamic programming proble ...

  5. HDU 4975 A simple Gaussian elimination problem.

    A simple Gaussian elimination problem. Time Limit: 1000ms Memory Limit: 65536KB This problem will be ...

  6. HDU 4971 A simple brute force problem.

    A simple brute force problem. Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged o ...

  7. hdu 4975 A simple Gaussian elimination problem.(网络流,推断矩阵是否存在)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4975 Problem Description Dragon is studying math. One ...

  8. hdu - 4975 - A simple Gaussian elimination problem.(最大流量)

    意甲冠军:要在N好M行和列以及列的数字矩阵和,每个元件的尺寸不超过9,询问是否有这样的矩阵,是独一无二的N(1 ≤ N ≤ 500) , M(1 ≤ M ≤ 500). 主题链接:http://acm ...

  9. hdu 4975 A simple Gaussian elimination problem 最大流+找环

    原题链接 http://acm.hdu.edu.cn/showproblem.php?pid=4975 这是一道很裸的最大流,将每个点(i,j)看作是从Ri向Cj的一条容量为9的边,从源点除法连接每个 ...

随机推荐

  1. Android学习笔记:TabHost 和 FragmentTabHost(转)

    转自:http://www.cnblogs.com/asion/p/3339313.html   作者:Asion Tang   出处:http://asiontang.cnblogs.com   T ...

  2. Careercup - Google面试题 - 4557716425015296

    2014-05-03 21:57 题目链接 原题: Many sticks with length, every time combine two, the cost is the sum of tw ...

  3. ORA-00257: 归档程序错误。在释放之前仅限于内部连接

    今天发现oracle数据库连不上,报错:ORA-00257: 归档程序错误.在释放之前仅限于内部连接 马上联想到可能是空间满了,一看磁盘目录,果然. 解决方法如下: 1:查看归档日志目录. 登陆账号后 ...

  4. 2875: [Noi2012]随机数生成器 - BZOJ

    DescriptionInput 包含6个用空格分割的m,a,c,X0,n和g,其中a,c,X0是非负整数,m,n,g是正整数. Output 输出一个数,即Xn mod gSample Input ...

  5. vim插件介绍

    代码补全 http://blog.sina.com.cn/s/blog_a6559d920101acv3.html这个牛逼.************************************** ...

  6. Codeforces Round #352 (Div. 2) D. Robin Hood

    题目链接: http://codeforces.com/contest/672/problem/D 题意: 给你一个数组,每次操作,最大数减一,最小数加一,如果最大数减一之后比最小数加一之后要小,则取 ...

  7. iOS开发之数据存取2-CoreData后台查询数据

    注意:本人所讲的后台查询必须在使用CoreData时选择存储类型为“SQLite”,因为二进制或者XML存储方式会在打开的时候直接读到内存中. 1.CoreData数据后台查询出现的情况 CoreDa ...

  8. 用windows远程连接linux桌面(使用tightvnc或者tigervnc)

    一.安装tightvnc: tightvnc的安装在安装包中有详细的说明(README文件) 首先你要确保linux已经安装jpeg和zlib库, 2.编译 执行如下两个命令: [root@local ...

  9. 《head first java 》读书笔记(二)

    Updated 2014/03/27 P402-P454 Updated 2014/04/03 P454- 世界三大首席管理器: border, flow, box borderLayout: 五个区 ...

  10. 漫谈CGI FastCGI WSGI

    作者:auxten链接:https://zhuanlan.zhihu.com/p/20054757来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. CGI(Common ...