CODE[VS] 1275有鱼的声音 2012年CCC加拿大高中生信息学奥赛

题目描述 Description

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”。

输入描述 Input Description

The input will be four positive integers, representing the depth readings. Each integer will be on its own line of input.

输入会是四个正整数,代表深度读入。每个整数会占一行。

输出描述 Output Description

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.

输出就是四种情况。

样例输入 Sample Input

样例1:

30 10 20 20

样例2:

1 10 12 13

样例输出 Sample Output

样例1:

No Fish

样例2:

Fish Rising

数据范围及提示 Data Size & Hint

数据很小

学考完之后第一天回到机房。。。

啥也不想干。

然后首先是被通知可歆妹子即将要过生日。

却不知道送啥。

然后再就是说暑期出去培训的事儿。

made我怎么可能单独跟一个我十分讨厌的人住一起呢。

我当然誓死和61级妹子们在一块儿了。

机房蚊子真多。。。

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<algorithm>
 4 #include<cmath>
 5 #include<cstring>
 6 using namespace std;
 7 
 8 int a[5];
 9 int up,down,as;
10 
11 int main()
12 {
13     for(int i=1;i<=4;++i)
14         scanf("%d",&a[i]);
15     for(int i=1;i<4;++i)
16     {
17         if(a[i+1]>a[i]) up++;
18         if(a[i+1]<a[i]) down++;
19         if(a[i+1]==a[i]) as++;
20     }
21     if(up==3) printf("Fish Rising");
22     else if(down==3) printf("Fish Diving");
23     else if(as==3) printf("Fish At Constant Depth");
24     else printf("No Fish");
25     return 0;
26 }
简单的模拟

如果你不开心,那我就把右边这个帅傻子分享给你吧,
你看,他这么好看,跟个zz一样看着你,你还伤心吗?
真的!这照片盯上他五秒钟就想笑了。
一切都会过去的。
时间时间会给你答案2333
 
 
原文地址:https://www.cnblogs.com/Mary-Sue/p/9236281.html