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的更多相关文章

  1. codeforce1029B B. Creating the Contest(简单dp,简单版单调栈)

    B. Creating the Contest time limit per test 1 second memory limit per test 256 megabytes input stand ...

  2. 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 ...

  3. CodeForces B. Creating the Contest

    http://codeforces.com/contest/1029/problem/B You are given a problemset consisting of nn problems. T ...

  4. B. Creating the Contest(水题)

    直接水过 #include<iostream> #include<algorithm> using namespace std; ; int a[maxn]; int n, u ...

  5. 【贪心/DP/单调队列】【CF1029B】Creating the Contest

    Description 给你一个单调不下降的长度为n的序列,请你找出一个最长的子序列,满足找出的子序列中,\(A_i<=A_{i-1}~\times~2\),其中i为下标,A为找出的子序列.对于 ...

  6. 【CF1029B】Creating the Contest(贪心)

    题意: n<=2e5 思路:可以证明答案一定是极长的一段中取最大值 #include<cstdio> #include<cstring> #include<stri ...

  7. Codeforces 1029B. Creating the Contest 动态规划O(nlogn)解法 及 单调队列O(n)解法

    题目链接:http://codeforces.com/problemset/problem/1029/B 题目大意:从数组a中选出一些数组成数组b,要求 b[i+1]<=b[i]*2 . 一开始 ...

  8. 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 ...

  9. Codeforces Round #442 (Div. 2)

    A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input s ...

  10. Gym 100712

    我的作用:增加罚时. noip380分大佬全程带飞出了10T,可惜被我搞的罚时太高了... 那啥,你会发现java代码有两种风格,嗯两个人,c++自然就是自招大佬了... A:大水题略 B:(不是我写 ...

随机推荐

  1. CH9434-MCU代码移植,芯片使用详细说明(附Linux开发资料链接)

    简介 CH9434是一款SPI转四串口转接芯片,提供四组全双工的9线异步串口,用于单片机/嵌入式/安卓系统扩展异步串口.提供25路GPIO,以及支持RS485收发控制引脚TNOW.本篇基于STM32F ...

  2. 完整数据分析流程:Python中的Pandas如何解决业务问题

    开篇 作为万金油式的胶水语言,Python几乎无所不能,在数据科学领域的作用更是不可取代.数据分析硬实力中,Python是一个非常值得投入学习的工具. 这其中,数据分析师用得最多的模块非Pandas莫 ...

  3. CVE-2022-32532 Apache Shiro 身份认证绕过

    漏洞名称 CVE-2022-32532 Apache Shiro 身份认证绕过 利用条件 Apache Shiro < 1.9.1 漏洞原理 使用RegexRequestMatcher进行权限配 ...

  4. 算法学习笔记(5): 最近公共祖先(LCA)

    最近公共祖先(LCA) 目录 最近公共祖先(LCA) 定义 求法 方法一:树上倍增 朴素算法 复杂度分析 方法二:dfs序与ST表 初始化与查询 复杂度分析 方法三:树链剖分 DFS序 性质 重链 重 ...

  5. SOFAJRaft源码阅读-ShutdownHook如何优雅的停机

    Java程序经常会遇到进程挂掉的情况,一些状态没有正确的保存下来,这时候就需要在JVM关掉的时候执行一些清理现场的代码.JAVA中的ShutdownHook提供了比较好的方案.而在SOFAJRaft- ...

  6. VUE Angular通用动态列表组件-亦可为自动轮播组件-02-根据数据量自动横向滚动,鼠标划入停止滚动

    本文为横向轮播,纵向轮播/动态列表组件请戳---- 代码是angular的,稍微改改就可以放入Vue项目里,差别不大哟 以下代码可以根据实际情况自行调整 父组件html <app-scroll- ...

  7. Blazor Hybrid (Blazor混合开发)更好的读取本地图片

    在 Blazor Hybrid 应用中,Razor 组件在设备上本机运行. 组件通过本地互操作通道呈现到嵌入式 Web View 控件. 组件不在浏览器中运行,并且不涉及 WebAssembly. R ...

  8. UML 图

    类的表示(Class) 第一层:显示类的名称,如果是抽象类,则就用斜体显示. 第二层:是类的特性,通常就是字段和属性. 第三层:是类的操作,通常是方法或行为(前面加号(+)表示public:减号(-) ...

  9. Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.1.0

    maven package 异常,今天打包springboot项目时碰到的问题. Failed to execute goal org.apache.maven.plugins:maven-resou ...

  10. bash原样输出字符串中的换行

    ➜ code $ cat test.sh #!/bin/bash nr="`cat -`"\" echo "$nr" echo $nr echo &q ...