MaratonIME plays Cîrokime
Have you ever seen flavored vodka?
Everaldo, Glauber
The MaratonIME members like to have fun. As they enjoy having fun so much, they have invented a game named “Cîrokime”. The game works as follows:

First, n cups with Cîroc1 are lined up. In front of the i-th cup a number ai is written. It is guaranteed that ai < ai + 1, for all 1 ≤ i < n. Then, the numbers are covered and the game starts.

The player must then find the cup that has a certain number x. It is guaranteed that this cup exists. For this, he has to choose a cup i and drink the beverage. Then, the cup’s number ai is revealed and if this number is equal to x the game finished. Otherwise, the player has to choose another cup and so on.

“Cîrokime” is a traditional game among MaratonIME members, they play it every party. At the last party, Sussu had to drink all of the n cups because he found the right cup only at the end. He got sick for drinking so much and had to be carried home3

However, the DESMAME4 is scheduled for May 13 and Sussu wants to restore his dignity. For this, he wants to know, in the worst case, what is the maximum number of cups that he will have to drink if he plays in the optimal way.

Input
The first line has a single integer n, the number of cups. The second line has n integers ai, the values hidden in each cup.

1 ≤ n ≤ 105
For all i, 1 ≤ ai ≤ 109
For i < n, ai < ai + 1
Output
The output has a single line with a single integer: the minimum number of cups that Sussu should drink, in the worst case, if he plays in the optimal way.

Examples
Input
3
2 5 7
Output
2
Input
8
1 2 3 4 5 6 7 8
Output
4

#include <stdio.h>
int fin(int n)
{if(n==1) return 1;else{return fin(n/2)+1;}
}
int main()
{int n,i;int a[100001],b;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);}b=fin(n);printf("%d\n",b);
}

MaratonIME plays Cîrokime相关推荐

  1. GYM MaratonIME plays Chess 模拟

    题目链接 GYM101744D 题解 题意 给出一个棋盘,上面分布着许多棋子,判断能否用自己的任意一个棋子在一步之内吃到指定的对面的棋子. 思路 模拟! 还是有很多可以回味的地方滴. 输入方面 可以看 ...

  2. CF1516E. Baby Ehab Plays with Permutations(组合数学)

    CF1516E. Baby Ehab Plays with Permutations Solution 因为组合水平不行所以只弄出来一个O(k4)O(k^4)O(k4)的做法(虽然随便改改可能就O(k ...

  3. Boboniu Plays Chess (模拟构造)

    Boboniu Plays Chess 题目链接 题意 : 一个n*m大的棋盘,在某个位置有一个棋子,棋子的走法和象棋中的"车"一样,要求输出棋子遍历完整个棋盘所有位置经过的位置. ...

  4. Chapter3.2 实现多个PLAYS

    3.2 实现多个PLAYS 3.2.1 目标 学完这一章节,学生能去: 编写一个剧本使用多个plays并且每个play进行权限提升 高效的使用ansible-doc去学习怎么样去使用新的模块去实现pl ...

  5. 论文笔记 AAAI 2021|what the role is vs. What plays the role: Semi-supervised Event Argument Extraction v

    文章目录 1 简介 1.1 动机 1.2 创新 2 方法 3 半监督双重训练策略 4 实验 1 简介 论文题目:What the role is vs. What plays the role: Se ...

  6. Codeforces 897D. Ithea Plays With Chtholly (交互)

    题目链接:D. Ithea Plays With Chtholly 题意: 给你n张纸,在纸上写字(在 1 - c之间)可以写m次数 (,).(主要是交互,让你判断) 题解: 首先,看到m>=n ...

  7. Codeforces D - Ithea Plays With Chtholly

    D - Ithea Plays With Chtholly 思路:考虑每个位置最多被替换c/2次 那么折半考虑,如果小于c/2,从左往右替换,大于c/2总右往左替换,只有小于这个数(从左往右)或者大于 ...

  8. CF1720A Burenka Plays with Fractions 题解

    洛谷传送门:Burenka Plays with Fractions - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 难度:普及- 知识点:数论 思路: a/b=c/d分数不直观, ...

  9. 【CodeForces】896 B. Ithea Plays With Chtholly

    [题目]B. Ithea Plays With Chtholly [题意]交互题,有n格,每次给一个[1,c]的数字,回答填入的位置后再次给数字,要求在m轮内使n格填满且数列不递减.n,m>=2 ...

最新文章

  1. 铜陵新松工业机器人项目_投资10亿元,茶山德威工业机器人和精密模具项目动工...
  2. dst matlab,DSTcode DST跟踪算法MATLAB代码,复杂环境中仿多目标 实现的单 Other systems 其他 272万源代码下载- www.pudn.com...
  3. gcc和g++的区别[zz]
  4. Java-POI操作excel清除单元格分行字符
  5. Linux traceroute路由跟踪
  6. android studio 配置国内镜像
  7. 程序员只能吃“青春饭”?C 认证带你破局!
  8. 线上python课程一般多少钱-排名前十的python零基础编程在线网课一对一费用多少钱...
  9. XidianOJ 1024 简单逆序对
  10. 不敢相信?System.currentTimeMillis() 居然存在性能问题
  11. 一起学OCP:oracle-082题库及解析(1-20)
  12. Button点击事件的五种写法
  13. 校友会2020计算机专业排名,校友会2020中国一流专业排名1200强公布,北大位列第一...
  14. 【leetcode-652】寻找重复的子树
  15. openssl的微缩图计算
  16. [C++]cpp小笔记3 --- C++ String and char
  17. mybatis的几种锁
  18. ssm+java企业公司产品分销商管理系统
  19. 无人驾驶感知篇之融合(一)
  20. 服务器怎么防ddos攻击

热门文章

  1. 阿里云ACP云计算错题集1-40
  2. 是什么引发了我对知识的渴望
  3. 基于DS18B20温度检测
  4. app爬虫之航班数据获取
  5. leetcode每日一题·救生艇问题(Python)
  6. 揭开500亿“区块链”骗局
  7. WSDM'23 | 工业界搜推广nlp论文整理
  8. 熬夜慢性自杀全过程曝光 | 程序员入坑必读
  9. 3D 电影、全息显示这些技术如何骗过我们的眼睛?
  10. 计算机组装慕课平台,计算机组装与维修