A - Mishka and Contest

Mishka started participating in a programming contest. There are n problems in the contest. Mishka's problem-solving skill is equal to k

.

Mishka arranges all problems from the contest into a list. Because of his weird principles, Mishka only solves problems from one of the ends of the list. Every time, he chooses which end (left or right) he will solve the next problem from. Thus, each problem Mishka solves is either the leftmost or the rightmost problem in the list.

Mishka cannot solve a problem with difficulty greater than k

. When Mishka solves the problem, it disappears from the list, so the length of the list decreases by 1

. Mishka stops when he is unable to solve any problem from any end of the list.

How many problems can Mishka solve?

Input

The first line of input contains two integers n

and k (1≤n,k≤100

) — the number of problems in the contest and Mishka's problem-solving skill.

The second line of input contains n

integers a1,a2,…,an (1≤ai≤100), where ai is the difficulty of the i

-th problem. The problems are given in order from the leftmost to the rightmost in the list.

Output

Print one integer — the maximum number of problems Mishka can solve.

Examples

Input
8 4
4 2 3 1 5 1 6 4
Output
5
Input
5 2
3 1 2 1 3
Output
0
Input
5 100
12 34 55 43 21
Output
5

Note

In the first example, Mishka can solve problems in the following order: [4,2,3,1,5,1,6,4]→[2,3,1,5,1,6,4]→[2,3,1,5,1,6]→[3,1,5,1,6]→[1,5,1,6]→[5,1,6]

, so the number of solved problems will be equal to 5

.

In the second example, Mishka can't solve any problem because the difficulties of problems from both ends are greater than k

.

In the third example, Mishka's solving skill is so amazing that he can solve all the problems.

 #include<stdio.h>
int main()
{
int n,k;
int a[];
int s=;
int t=;
scanf("%d %d",&n,&k);
for(int i=;i<n;i++)
{
scanf("%d",&a[i]);
}
for(int i=;i<n;i++)
{ if(a[i]<=k)
{
s++;
t++;
}
else
break;
}
for(int i=n-;i>=t;i--)
{
if(a[i]<=k)
{
s++;
}
else
break;
}
printf("%d\n",s);
return ;
}

ACM 第二天的更多相关文章

  1. ACM第二次比赛( C )

    Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description Vanya ...

  2. ACM第二站————归并排序

    转载请注明出处,谢谢!http://www.cnblogs.com/Asimple/p/5459664.html 归并排序————二分的思想 以中间的数为基准,每次排序都将比其小[升序排](大[降序排 ...

  3. Sdut 2164 Binomial Coeffcients (组合数学) (山东省ACM第二届省赛 D 题)

    Binomial Coeffcients TimeLimit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 输入 输出 示例输入 1 1 10 2 9 ...

  4. Sdut 2165 Crack Mathmen(数论)(山东省ACM第二届省赛E 题)

    Crack Mathmen TimeLimit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Since mathmen take security ...

  5. ACM第二题 生理周期

    人生来就有三个生理周期,分别为体力.感情和智力周期,它们的周期长度为23天.28天和33天.每一个周期中有一天是高峰.在高峰这天,人会在相应的方面表现出色.例如,智力周期的高峰,人会思维敏捷,精力容易 ...

  6. ACM第二站————STL之stack

    栈,作为一种最基础的数据结构(栈还是一种内存的存储形式,就不介绍了),在各种数据结构的题目都会间接或者直接用到. 栈是一种受到限制的线性表,其限制是仅允许在表的一端进行插入和删除运算.这也给予了栈的一 ...

  7. 2018.10.2浪在ACM 集训队第二次测试赛

    2018.10.26 浪在ACM 集训队第二次测试赛 题目一览表 来源 考察知识点 A 1273 海港 NOIP 普及组 2016 差分数组+二分 B 1274 魔法阵     C 1267 金币   ...

  8. 牛客网 暑期ACM多校训练营(第二场)A.run-动态规划 or 递推?

    牛客网暑期ACM多校训练营(第二场) 水博客. A.run 题意就是一个人一秒可以走1步或者跑K步,不能连续跑2秒,他从0开始移动,移动到[L,R]的某一点就可以结束.问一共有多少种移动的方式. 个人 ...

  9. 2018牛客网暑期ACM多校训练营(第二场)I- car ( 思维)

    2018牛客网暑期ACM多校训练营(第二场)I- car 链接:https://ac.nowcoder.com/acm/contest/140/I来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 ...

随机推荐

  1. Python2和Python3

    1. 字符编码 1.1. Python2默认为ACSII编码 1.2. Python3为Unicode 2. Unicode和UTF8和GBK编码的关系 utf8:中文3字节              ...

  2. 关于MySQL的锁机制详解

    锁概述 MySQL的锁机制,就是数据库为了保证数据的一致性而设计的面对并发场景的一种规则. 最显著的特点是不同的存储引擎支持不同的锁机制,InnoDB支持行锁和表锁,MyISAM支持表锁. 表锁就是把 ...

  3. 《JQuery常用插件教程》系列分享专栏

    <JQuery常用插件教程>已整理成PDF文档,点击可直接下载至本地查阅https://www.webfalse.com/read/201719.html 文章 使用jquery插件实现图 ...

  4. <简明>Markdown指南

    什么是Markdown?Markdown是一种轻量级的「标记语言」,通常为程序员群体所用,目前它已是全球最大的技术分享网站 GitHub 和技术问答网站 StackOverFlow 的御用书写格式. ...

  5. 创龙DSP6748开发板上电测试-第一篇

    1. 创龙DSP6748开发板测试.2980元的售价很高,我估计新的1200元比较合适,当然创龙定价是按照供需关系的.仿真器XDS100V2卖598元,真是狮子大张口. 2. 上电是5V-2A的电源. ...

  6. Ruby 基础教程1-4

    1.对象 数值对象 字符串对象 数组对象,散列对象 正则表达式对象 时间对象 文件对象 符号对象 2.类 Numeric String Array Hash Regexp File Symbol 3. ...

  7. 使用git bash编译安装sysbench时遇到的坑

      Preface       When I was compiling the sysbench just now,I encountered some failures in the preced ...

  8. 「日常训练」COMMON 约数研究(HYSBZ-1968)

    题意与分析 感谢https://www.cnblogs.com/Leohh/p/7512960.html的题解.这题话说原来不在我的训练范围,正好有个同学问我,我就拿来做做.数学果然不是我擅长的啊,这 ...

  9. 如何理解一台服务器可以绑定多个ip,一个ip可以绑定多个域名

    一个域名只能对应一个IP的意思是域名在DNS服务器里做解析的时候 一条记录只能指向一个IP地址.这个是死规定,试想一下,如果一个子域名指向了2个ip ,当访问者打开这个域名的时候,浏览器是展示哪个IP ...

  10. 学好三角学(函数) — SWIFT和JAVASCRIPT游戏开发的必备技能 iFIERO.com

    不论是使用哪种平台进行开发,三角学在游戏当中都被广泛的使用,因此,小编iFERO认为,三角学是必须得掌握的技能之一. 游戏图片由 摘自 Razeware LLC 先以Javascript为例 一.角度 ...