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,把 ...
随机推荐
- SVN快速入门(TSVN)
作者: 北京群英汇信息技术有限公司 网址: http://www.ossxp.com/ 版本: 0.1-35 日期: 2011-07-05 10:51:59 版权信息: 目录 1 安装Tortoi ...
- [BZOJ 2186][Sdoi2008]沙拉公主的困惑(欧拉函数)
题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=2186 分析: 就是要求1~n!中与m!互质的数的个数 首先m!以内的就是φ(m!) 关 ...
- Grovvy之解析XML文件
假设现有customer.xml 文件内容如下: <?xml version="1.0" ?> <customers> <corporate> ...
- Customizing Navigation Bar and Status Bar
Like many of you, I have been very busy upgrading my apps to make them fit for iOS 7. The latest ver ...
- “耐撕”团队 2016.04.07 站立会议
1. 时间: 20:00--20:15 共计20分钟. 2. 成员: Z 郑蕊 * 组长 (博客:http://www.cnblogs.com/zhengrui0452/), P 濮成林(博客:ht ...
- 读代码之private construtor
private 构造函数 private修饰构造函数在Singleton设计模式中经常使用.但是今天在读到EntityUtils时,发现这是一个final类.final很好理解:EntityUtils ...
- webstrom 中启用emmet插件的方法
参考页面:https://www.jetbrains.com/help/webstorm/2016.2/enabling-emmet-support.html Basics Native Emmet ...
- simple-LDAP-auth / ldap_auth.php
<?php /** * simple class for LDAP authentification * Copyright (C) 2013 Petr Palas This program i ...
- 【SGU 104】Little shop of flowers
题意 每个花按序号顺序放到窗口,不同窗口可有不同观赏值,所有花都要放上去,求最大观赏值和花的位置. 分析 dp,dp[i][j]表示前i朵花最后一朵在j位置的最大总观赏值. dp[i][j]=max( ...
- Oracle自定义函数1
用户定义函数是存储在数据库中的代码块,可以把值返回到调用程序.调用时如同系统函数一样,如max(value)函数,其中,value被称为参数.函数参数有3种类型. IN 参数类型:表示输入给函数的参数 ...