HNU 12812 Broken Audio Signal
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12812
一直弄错了一个题意,教训啊,比赛最怕的就是弄错题意了
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
const int maxn = +;
int num[maxn],X[maxn],flag[maxn]; int main()
{
// freopen("A2.out","w",stdout);
// freopen("A.in","r",stdin);
int n;
char str[];
while(scanf("%d",&n),n)
{
memset(flag,,sizeof(flag));
int num_x = ,end = ;
for(int i = ;i <= n;++i)
{
scanf("%s",str);
if(str[] == 'X' || str[] == 'x')
{
flag[i] = ;
X[num_x++] = i;
}
else num[i] = atoi(str);
if(i > && flag[i] == && flag[i-] == )
end = ;
}
if(num_x >= n || end) /////全是x无法判断,超过两个x在一起也是无解
{
printf("none\n");
continue;
}
for(int i = ;i < n;++i)
if(flag[i] == && flag[i+] == )
{
if(((i & ) && num[i] >= num[i+]) || (!(i & ) && num[i] <= num[i+]))
{
end = ;
break;
}
}
if(end) /////出现不符合规则的情况
{
printf("none\n");
continue;
}
int l = -0x7fffffff,r = 0x7fffffff;
for(int i = ;i < num_x;++i)
if(X[i] & )
{
if(X[i] > && flag[X[i]-] == )
r = min(r,num[X[i]-] - );
if(X[i] < n && flag[X[i]-] == )
r = min(r,num[X[i]+] - );
}
else
{
if(X[i] > && flag[X[i]-] == )
l = max(l,num[X[i]-] + );
if(X[i] < n && flag[X[i]+] == )
l = max(l,num[X[i]+] + );
}
if(l == r)
printf("%d\n",l);
else if(l > r)
printf("none\n");
else printf("ambiguous\n");
}
return ;
}
HNU 12812 Broken Audio Signal的更多相关文章
- Building a Radio Listening Station to Decode Digital Audio & Police Dispatches
On April 7, 2017, residents in Dallas, Texas, woke to the sound of emergency sirens blaring all over ...
- linux音频 DAPM之二:audio paths与dapm kcontrol
转:https://blog.csdn.net/wh_19910525/article/details/12749293 在用alsa_amixer controls时,除了我们之前提到的snd_so ...
- RTP Payload Format for Opus Speech and Audio Codec
[Docs] [txt|pdf] [Tracker] [WG] [Email] [Diff1] [Diff2] [Nits] Versions: (draft-spittka-payload-rtp- ...
- 《The challenge of realistic music generation: modelling raw audio at scale》论文阅读笔记
The challenge of realistic music generation: modelling raw audio at scale 作者:Deep mind三位大神 出处:NIPS ...
- A Tutorial on Using the ALSA Audio API
A Tutorial on Using the ALSA Audio API This document attempts to provide an introduction to the ALSA ...
- Introduction to Parallel Computing
Copied From:https://computing.llnl.gov/tutorials/parallel_comp/ Author: Blaise Barney, Lawrence Live ...
- Video for Linux Two API Specification Revision 2.6.32【转】
转自:https://www.linuxtv.org/downloads/legacy/video4linux/API/V4L2_API/spec-single/v4l2.html Video for ...
- Video for Linux Two API Specification revision0.24【转】
转自:http://blog.csdn.net/jmq_0000/article/details/7536805#t136 Video for Linux Two API Specification ...
- Dynamic range compression
这段时间终于把手头的东西都搞完了,还剩下一个AEC这个模块,这个模块跟整个系统机制有很大关系,单独的模块意义不大. 另外,刚写完一个分类器,希望能大幅提升音乐流派分类的准确率. 下周正式开搞AEC,把 ...
随机推荐
- storm基础框架分析
背景 前期收到的问题: 1.在Topology中我们可以指定spout.bolt的并行度,在提交Topology时Storm如何将spout.bolt自动发布到每个服务器并且控制服务的CPU.磁盘等资 ...
- 怎样写 OpenStack Neutron 的 Plugin (二)
其实上一篇博文中的内容已经涵盖了大部分写Neutron插件的技术问题,这里主要还遗留了一些有关插件的具体实现的问题. 首先,Neutron对最基本的三个资源:Network, Port 和 Subne ...
- AutoMapper用法(转载)
申明 本文转载自http://www.qeefee.com/article/automapper 作者:齐飞 配置AutoMapper映射规则 AutoMapper是基于约定的,因此在实用映射之前,我 ...
- Thinkphp 边学边用-验证码无意间犯的错
先看代码: $(".verify_img").click(function(){ var timenow = new Date().getTime(); var url =&quo ...
- Unity3D 2D游戏中寻径算法的一些解决思路
需求 unity3d的3d开发环境中,原生自带了Navigation的组件,可以很便捷快速的实现寻路功能.但是在原生的2d中并没有相同的功能. 现在国内很多手机游戏都有自动寻路的功能,或者游戏中存在一 ...
- 实现一个基于WCF的分布式缓存系统
tks:http://www.cnblogs.com/xiguain/p/3913220.html
- 第二十六课:jQuery对事件对象的修复
因为原生的event对象,在不同浏览器下,有不同的属性和方法,因此需要用jQuery进行兼容. jQuery在这里分两步走,首先创建一个伪事件类jQuery.Event(jQuery里面自定义的事件类 ...
- Go语言_时间篇
Go的time包是标准库中的包之一 不用说,几乎是开发必须用到的包之一.time包的说明文档在: http://golang.org/pkg/time/ 先注意下Overview中的一句话: The ...
- 似然估计中为什么要取对数以GMM为例
1.往往假设特征之间独立同分布,那么似然函数往往是连城形式,直接求骗到不好搞,根据log可以把连乘变为连加. 2.另外概率值是小数,多个小数相乘容易赵成浮点数下溢,去log变为连加可以避免这个问题. ...
- org.springframework.beans.factory.annotation.Autowired(required=true)
Injection of autowired dependencies failed ERROR org.springframework.web.context.ContextLoader - Co ...