codeforce B. Creating the Contest
http://codeforces.com/contest/1029/problem/B
水题真快乐= =
1 public class Main {
2 public static void main(String[] args) {
3 Scanner io = new Scanner(System.in);
4 long n = io.nextInt() - 1, a = io.nextInt(), b, len = 1, ans = 1;
5 for (int i = 1; i <= n; i++) {
6 b = io.nextInt();
7 if (i == n) {
8 if (a * 2 >= b) len++;
9 ans = Math.max(ans, len);
10 break;
11 } else if (a * 2 < b) {
12 ans = Math.max(ans, len);
13 len = 0;
14 }
15 len++;
16 a = b;
17 }
18 System.out.println(ans);
19 }
20 }
codeforce B. Creating the Contest的更多相关文章
- codeforce1029B B. Creating the Contest(简单dp,简单版单调栈)
B. Creating the Contest time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Codeforces Round #506 (Div. 3)B.Creating the Contest(dp)
B. Creating the Contest time limit per test 1 second memory limit per test 256 megabytes input stand ...
- CodeForces B. Creating the Contest
http://codeforces.com/contest/1029/problem/B You are given a problemset consisting of nn problems. T ...
- B. Creating the Contest(水题)
直接水过 #include<iostream> #include<algorithm> using namespace std; ; int a[maxn]; int n, u ...
- 【贪心/DP/单调队列】【CF1029B】Creating the Contest
Description 给你一个单调不下降的长度为n的序列,请你找出一个最长的子序列,满足找出的子序列中,\(A_i<=A_{i-1}~\times~2\),其中i为下标,A为找出的子序列.对于 ...
- 【CF1029B】Creating the Contest(贪心)
题意: n<=2e5 思路:可以证明答案一定是极长的一段中取最大值 #include<cstdio> #include<cstring> #include<stri ...
- Codeforces 1029B. Creating the Contest 动态规划O(nlogn)解法 及 单调队列O(n)解法
题目链接:http://codeforces.com/problemset/problem/1029/B 题目大意:从数组a中选出一些数组成数组b,要求 b[i+1]<=b[i]*2 . 一开始 ...
- Codeforces Round #442 A Alex and broken contest【字符串/常量数组/string类】
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- Codeforces Round #442 (Div. 2)
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- Gym 100712
我的作用:增加罚时. noip380分大佬全程带飞出了10T,可惜被我搞的罚时太高了... 那啥,你会发现java代码有两种风格,嗯两个人,c++自然就是自招大佬了... A:大水题略 B:(不是我写 ...
随机推荐
- 47.DRF实现分页
分页Pagination 当我们在PC 或者 App 有大量数据需要展示时,可以对数据进行分页展示.这时就用到了分页功能,分页使得数据更好的展示给用户 比如我们有1W+数据要返回给前端,数据量 ...
- 【集成开发环境 (IDE)】Dev-Cpp下载与安装 [ 图文教程 ]
版权声明 本文作者:main工作室 本文链接:https://www.cnblogs.com/main-studio/p/17037280.html 版权声明:本文为 博客园 博主「main工作室」的 ...
- 《爆肝整理》保姆级系列教程-玩转Charles抓包神器教程(3)-再识Charles
1.简介 上一篇通过宏哥的介绍想必各位小伙伴或者童鞋们对Charles已经有了一个理性地认识,今天宏哥在从Charles的外貌介绍和分享一下,让小伙伴们或者童鞋们再对Charles有一个感性的认识,今 ...
- 深入探究Java中的对象类型变量声明操作——在声明对象时,系统究竟做了什么?
深入探究Java中的对象类型变量声明操作--在声明对象时,系统究竟做了什么? 摘要:本文主要对Java中的对象类型变量的声明的底层原理做了探究. 目录 深入探究Java中的对象类型变量声明操作--在声 ...
- rvm安装ruby
macOS11.1 打开终端 使用下面命令查看ruby版本 rvm list known 然后安装 rvm install 2.0.0 查看ruby版本 ruby -v 系统默认使用ruby版本 ...
- 刷题笔记——3003.鸡兔同笼问题 & 2767.计算多项式的值
题目1 3003.鸡兔同笼问题 代码 while True: try: x,y=map(int,input().strip().split()) a = int((4*x-y) / 2) b = x ...
- __int128:懒人的福音
前言 对于一个懒懒的,不想写高精的人(就是我),每次都会遭遇到答案爆$long$ $long$的危险 比如说这道题: 题目传送门 最后的$23-25$的两个点,$long$ $long$甚至$un ...
- VUE assets里的scss没有引用会被打包进代码里,本地代码和打包后的代码样式不一致解决办法
1.打包部署后,发现样式和本地运行时候代码不一致 经过排查发现 这个路径的文件被打包进去了,但是我并没有引用这个文件啊啊啊啊啊a~~~~ src\assets\webgl-assets\scss\st ...
- 【分析笔记】LVGL v8.2.0 使用 freetype 概率性无显示的问题
使用目前最新的 Releases 版本 LVGL v8.2.0 ,移植好 freetype2 后测试,发现每次启动程序时会高概率出现屏幕显示全白色背景,无任何内容的问题. 打开日志开关,出现问题时会有 ...
- spring cloud alibaba Nacos集群部署 Linux
参考:https://www.cnblogs.com/dw3306/p/12961353.html 1.官网: https://nacos.io/zh-cn/docs/cluster-mode- ...