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(先进 ...
随机推荐
- mysql提升效率
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索 ...
- Okhttp3发送xml、json、文件的请求方法
1.引入依赖 <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okht ...
- jQuery 价格显示 前面位数与后面两位显示不同样式(一大一小)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Jmeter之https请求
Jmeter之录制https脚本,网上介绍了好多种方法,大家自行百度. 如果手写https脚本,该如何做呢? 方法:http信息头管理器,加入User-Agent参数 案例:手写百度的搜索:哈哈 请 ...
- Asp.Net MVC中Controller、Action、View是如何激活调用的
上篇我们介绍了MVC的路由,知道在注册路由的时候会创建一个MvcHandler将其和Url规则一起放入到了RouteCollection中,之后请求通过UrlRoutingModule,根据当前的UR ...
- 利用jquery制作滚动到指定位置触发动画
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>利用 ...
- js检测是哪个浏览器
项目中遇到在火狐浏览器下引入iframe页面,导致那个地方感觉掉下去一点,解决方案就是单独对火狐浏览器进行样式处理,需要检测浏览器类型,在网上找到此方法解决问题,也分享给大家 function get ...
- CentOS7.4 搭建和使用telnet
1.先检查是否安装了telnet rpm -qa | grep telnet //检查你的CentOS是否安装了telnet和telnet-server rpm -qa xinetd //检查你的C ...
- nginx配置错误页面
有时候页面会遇到404页面找不到错误,或者是500.502这种服务端错误,这时候我们可能希望自己定制返回页面,不希望看到默认的或者是内部的错误页面,可以通过nginx配置来实现. 1 50x错误对于5 ...
- 升级PHP7操作MongoDB
前言 使用 PHP+MongoDB 的用户很多,因为 MongoDB 对非结构化数据的存储很方便.在 PHP5 及以前,官方提供了两个扩展,Mongo 和 MongoDB,其中 Mongo 是对以 M ...