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,把 ...
随机推荐
- Java Web系列:Spring Boot 基础
Spring Boot 项目(参考1) 提供了一个类似ASP.NET MVC的默认模板一样的标准样板,直接集成了一系列的组件并使用了默认的配置.使用Spring Boot 不会降低学习成本,甚至增加了 ...
- WCF Data Service 使用小结(二) —— 使用WCF Data Service 创建OData服务
在 上一章 中,介绍了如何通过 OData 协议来访问 OData 服务提供的资源.下面来介绍如何创建一个 OData 服务.在这篇文章中,主要说明在.NET的环境下,如何使用 WCF Data Se ...
- http请求过程简要
一次http请求主要分为3个大步. 建立tcp连接. 这里就发生了经典的tcp三次握手.做个类比解释下,tcp好比http的秘书,和厂家(服务器端)做买卖.老板(http)叫秘书(tcp)去联系一下, ...
- css边框阴影
<style type="text/css">.mydiv{width:250px;height:auto;border:#909090 1px solid;backg ...
- android之imgView插件的使用
在开发中我们经常要用到图片下载功能,但我们可以在github上淘一些比较好的插件,这里介绍一款叫smartImageView的插件. 这里是其地址https://github.com/loopj/an ...
- datepicker自定义 -- iOS
/** * 创建时间选择器 */ - (void)createPickerView { self.datePicker = [[UIDatePicker alloc] init]; _datePick ...
- linux 安装webbench
webbench :1.5 http://soft.vpser.net/test/webbench/webbench-1.5.tar.gz从官网下载webbench-1.5.tar.gz1.解压 t ...
- jQuery Mobile学习日记
本次主讲人是王思伦啦啦啦~ 框架特性 jQuery Mobile 以“Write Less, Do More”作为目标,为所有的主流移动操作系统平台提供了高度统一的 UI 框架:jQuery 的移动框 ...
- Hibernate-二级缓存 sessionFactory
Hibernate 二级缓存 二级缓存需要sessionFactory来管理,它是进初级的缓存,所有人都可以使用,它是共享的. 当Hibernate根据ID访问数据对象的时候,首先从Session一级 ...
- 洛谷P2726 阶乘 Factorials
题目背景 N的阶乘写作N!,表示小于等于N的所有正整数的乘积. 题目描述 阶乘会变大得很快,如13!就必须用32位整数类型来存储,到了70!即使用浮点数也存不下了. 你的任务是找到阶乘最前面的非零位. ...