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,把 ...
随机推荐
- Object-Oriented CSS
1.指导思想: http://oocss.org/ 2.reset.css http://meyerweb.com/eric/tools/css/reset/ 3.normalize.css http ...
- Linux下高频命令分类辑录(基本使用篇)
本文目的:总结linux下常用命令的基本使用方法 文件权限: 文档权限设置命令:chmod 数字模式: 文档权限由-rwxrwxrwx十个字符组成,其中第一个代表文档类型,后面九个字符按照顺序分为三组 ...
- #Linux学习笔记# Linux系统查看文件内容的命令
1.cat 连结多个文件的内容并显示在屏幕上:如果没有指定文件或文件名为“-”,则读取标准输入.语法如下: cat [option] ... [file] ... 常用的选项有: 选项-n:编号所有行 ...
- http请求过程简要
一次http请求主要分为3个大步. 建立tcp连接. 这里就发生了经典的tcp三次握手.做个类比解释下,tcp好比http的秘书,和厂家(服务器端)做买卖.老板(http)叫秘书(tcp)去联系一下, ...
- jQuery理解之(二)功能函数
在javascript编程中,开发者通常需要编写很多小程序来实现一些特定的功能.例如浏览器检测,字符串处理.数组的编辑等.jQuery对这些常用的程序进行了总结,提供了很多实用的函数. 1.检测浏览器 ...
- CSS3——动画效果
CSS3动画在Style里面就实现了以往我们用JQ写的动画效果,着实简便了不少~ 简单Demo: html代码: <div id="dv1"></div> ...
- netbeans 快捷键
前言:今天开始学习使用netbeans , 在此之前,我习惯性的使用 Eclipse 的快捷键,所以,我要改造下~ 1.Application应用程序的参数args的设置,在Build->Set ...
- shell中一维数组值得获取
(1)数组的定义 root@tcx4440-03:~# a=(1 2 3 4) root@tcx4440-03:~# echo ${a[1]}2 root@tcx4440-03:~# a[0]=1ro ...
- array,vertor,arraylist,hashable,hashmap等几个易混淆概念的区别
Array可以存放Object和基本数据类型,但创建时必须指定数组的大小,并不能再改变, Vertor是放的Object. Vertor一维,Hashmap/Hashtabe二维: Vertor/Ar ...
- SpringMVC实战
一.SpringMVC基础入门,创建一个HelloWorld程序 1.首先,导入SpringMVC需要的jar包. 2.添加Web.xml配置文件中关于SpringMVC的配置 1 2 3 4 5 6 ...