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. Kali-Linux-for-Docker

    说明 基于kali官方开源的Docker镜像修改,如需使用官方固件可以前往https://hub.docker.com/r/kalilinux/kali-rolling Docker Hub http ...

  2. .NET性能优化-使用RecyclableMemoryStream替代MemoryStream

    提到MemoryStream大家可能都不陌生,在编写代码中或多或少有使用过:比如Json序列化反序列化.导出PDF/Excel/Word.进行图片或者文字处理等场景.但是如果使用它高频.大数据量处理这 ...

  3. Spark详解(01) - Scala编程语言

    Spark详解(01) - Scala编程语言概述 Scala官网:https://www.scala-lang.org/ 什么是Scala 从英文的角度来讲,Scala并不是一个单词,而是Scala ...

  4. VMware Workstation Pro 16安装CentOS7超详细图文步骤

    安装的需要 VMware官方网站安装VMware Workstation Pro 16: https://download3.vmware.com/software/wkst/file/VMware- ...

  5. python之路26 面向对象魔法方法、元类、元类定制类、对象的产生行为 __new__方法

    面向对象的魔法方法 魔法方法:类中定义的双下方法都称为魔法方法 不需要人为调用 在特定的条件下会自动触发运行 eg:__init__创建空对象之后自动触发给对象添加独有的数据 1.__init__ 对 ...

  6. Cert Manager 申请 SSL 证书流程及相关概念 - 一

    2022.3.9 用 cert-manager 申请成功通配符证书 (*.ewhisper.cn), 2022.4.30 该证书距离过期还有 30 天,cert-manager 进行自动续期,但是却失 ...

  7. ng-alain全局配置NzMessageService

    官方文档是这样子的,抄下来会报错,因为没有后两个设置 import { NgZorroAntdModule, NzConfig, NZ_CONFIG } from 'ng-zorro-antd'; c ...

  8. 【开源】libserial_protocol:适用于单片机的串口通信协议基础库

    借助五一假期,写了一个串口通信协议基础库,虽然写着适用于单片机,但实际上并不限制具体的硬件平台. 特点如下: 不涉及到具体硬件,libserial_protocol 纯软件协议,与具体硬件分离. 内存 ...

  9. 微信小程序搜索优化指南(SEO)

    前言 其实在 2019 年上半年,微信就发布了基于小程序页面的搜索. 为了更好地发现及理解小程序的页面,结合过去一段时间来我们遇到的各种情况,强烈建议各位开发者花一些宝贵的时间认真阅读本文. 小程序爬 ...

  10. vscode 配置复盘

        第一句话,看文档!code.visualstudio.com/docs/editor- 从这里开始看,上下辐射看完debug看task,然后再看其他的诸如"智能感知"    ...