codevs——1275 有鱼的声音
A fish-finder is a device used by anglers to find fish in a lake. If the fish-finder finds a fish, it will sound an alarm. It uses depth readings to determine whether to sound an alarm. For our purposes, the fish-finder will decide that a fish is swimming past if:
fish-finder是一个神奇的装置供垂钓者使用区在护理钓鱼。如果一个f-f找到了一条鱼,他会响起声音警报。它用鱼的深度来决定是否响警报。我们的目的就是要决定鱼是否通过,具体如下:
• there are four consecutive depth readings which form a strictly increasing sequence (such as 3 4 7 9) (which we will call “Fish Rising”), or
如果连续的四个深度读入是严格递增的序列,我们可以叫它 Fish Rising 。
• there are four consecutive depth readings which form a strictly decreasing sequence (such as 9 6 5 2) (which we will call “Fish Diving”), or
如果连续的四个深度读入是严格递减的序列,我们可以叫它 Fish Diving 。
• there are four consecutive depth readings which are identical (which we will call “Constant Depth”).
All other readings will be considered random noise or debris, which we will call “No Fish.”
Your task is to read a sequence of depth readings and determine if the alarm will sound.
如果连续的四个深度读入是一样的,那就是“Fish At Constant Depth”。如果都不是,就是“No Fish”。
The input will be four positive integers, representing the depth readings. Each integer will be on its own line of input.
输入会是四个正整数,代表深度读入。每个整数会占一行。
The output is one of four possibilities. If the depth readings are increasing, then the output should be Fish Rising. If the depth readings are decreasing, then the output should be Fish Diving. If the depth readings are identical, then the output should be Fish At Constant Depth. Otherwise, the output should be No Fish.
输出就是四种情况。
样例1:
30 10 20 20
样例2:
1 10 12 13
样例1:
No Fish
样例2:
Fish Rising
数据很小
活跃一下身心
代码‘:
#include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> using namespace std; ; ],b[]; int read() { ,f=; char ch=getchar(); ; ch=getchar();} +ch-'; ch=getchar();} return x*f; } int main() { ;i<=n;i++) a[i]=read(),b[i]=a[i]; sort(b+,b++n); ;i<=n;i++) { ]) a1++; ]) a2++; ]) a3++; } ) {printf(;} ;} ) {printf(;} printf(; }
codevs——1275 有鱼的声音的更多相关文章
- 菜鸡谈OO 第二单元总结
“欢迎来到(玄学)多线程的新世界” Homework1 单部傻瓜电梯调度 Part1 多线程设计策略 第一次学到了线程这个概念,与之前的编程体验大有不同.最大的区别在于从原本的线性发生程序变成了多个行 ...
- 【python游戏编程之旅】第五篇---嗷大喵爱吃鱼小游戏开发实例
本系列博客介绍以python+pygame库进行小游戏的开发.有写的不对之处还望各位海涵. 我们一同在前几期的博客中已经学到了很多pygame的基本知识了,现在该做个小游戏实战一下了. 前几期博客链接 ...
- CODEVS——T2744 养鱼喂妹纸
http://codevs.cn/problem/2744/ 时间限制: 1 s 空间限制: 64000 KB 题目等级 : 钻石 Diamond 题解 查看运行结果 题目描述 Descr ...
- Scratch编程:游来游去的鱼(二)
“ Scratch编程学习环境搭建好了吗?让我们一起来进行游戏吧!” 01 — 游戏介绍 这是一款简单的小游戏,实现了一条小鱼在池塘里游来游去. 02 — 设计思路 1,这个游戏主要由一个池塘背景和一 ...
- 5 秒克隆声音「GitHub 热点速览 v.21.34」
作者:HelloGitHub-小鱼干 本周特推的 2 个项目都很好用,Realtime-Voice-Clone-Chinese 能让你无需开启变声音,即可获得一个特定声音的语音.这个声音可以是你朋友的 ...
- 声音分贝的概念,dBSPL.dBm,dBu,dBV,dBFS
需要做个音频的PPM表,看着一堆的音频术语真是懵了,苦苦在网上扒了几天的文档,终于有了点收获,下面关于声音的分贝做个总结. 分贝 Decibel 分贝(dB)是一个对数单位(logarithmic u ...
- codevs 3289 花匠
题目:codevs 3289 花匠 链接:http://codevs.cn/problem/3289/ 这道题有点像最长上升序列,但这里不是上升,是最长"波浪"子序列.用动态规划可 ...
- AlloyTouch 0.2.0发布--鱼和熊掌兼得
原文链接:https://github.com/AlloyTeam/AlloyTouch/wiki/AlloyTouch-0.2.0 背景 公司师姐昨日在KM发了篇长文,主要结论RAF+transfo ...
- ubuntu声音系统
查看声卡:cat /proc/asound/cards 显示所有ALSA的组件:cat /proc/asound/device aplay -l ubuntu使用pulseaudio,是ALSA(先进 ...
随机推荐
- NavigationView的使用
代码已经分享至github:https://github.com/YanYoJun/NavigationDemo 转载请注明原文链接:http://www.cnblogs.com/yanyojun/p ...
- 机器学习-Logistic function(Sigmoid function)
下面给出H函数 由这个函数生成的曲线称为Sigmoid曲线 先不从数学上说为什么这个模型中二元分类上比线性模型好,单纯从图形上看就可以得到直观的结论 首先Y值域在[0,1],其次图形中中间陡峭而两 ...
- R in action读书笔记(3)-第六章:基本图形
第六章 基本图形 6.1条形图 条形图通过垂直的或水平的条形展示了类别型变量的分布(频数).函数:barplot(height) 6.1.1简单的条形图 6.1.2推砌条形图和分组条形图 如果hei ...
- 简述SVN服务器配置和客户端操作
有关SVN服务器的搭建见:http://www.cnblogs.com/DwyaneTalk/p/3997688.html 搭建好环境之后,服务器端需要完成如下操作: 1.需要新建Repository ...
- Java序列化技术性能分析(JDK原生与Protostuff)
熟悉Java的朋友应该知道Java有一个叫序列化的技术,即把一个Object转换为可保存,可传输的流数据.相应的,同时存在反序列化,即将流数据转换为Object类,而在转换的过程中,该Object保持 ...
- 【C++】朝花夕拾——STL vector
STL之vector篇 N久之前是拿C的数组实现过vector中的一些简单功能,什么深拷贝.增删查找之类的,以为vector的实现也就是这样了,现在想想真是...too young too naive ...
- template or render function not defined.
template or render function not defined. H_婷 关注 2018.08.16 17:22 字数 106 阅读 3859评论 0喜欢 2 下午写 Vue $par ...
- CE工具里自带的学习工具--第四关
图解:
- TabWight
//修改站号void CDlgParamView::OnPushButton_2_Tab8Clicked(){ // int iSel = m_listStation.GetSelectionMark ...
- C#解析单层html的中的文本,然后拼接起来
匹配单层html的小demo,应该能匹配大多数html字符串.多层(嵌套)html标签解析不出来.可能有小bug,我抛砖引玉下,哈哈. using System; using System.Colle ...