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. [seaborn] seaborn学习笔记11-绘图实例(3) Drawing example(3)

    11 绘图实例(3) Drawing example(3)(代码下载) 本文主要讲述seaborn官网相关函数绘图实例.具体内容有: Plotting a diagonal correlation m ...

  2. C++ 一种交换两个数的思路

    在 Lua 或者 Python 中可以使用多值赋值语句来交换两个数.例如:a, b = b, a.在 C++ 中有没有类似的操作? 先解析一下多值赋值的原理,a, b = b, a 等价于 t1, t ...

  3. 自定义alert弹框,去掉IP以及端口号提示

    最新版例子~~  如果同时多个弹框,只显示第一个 <!DOCTYPE html> <html lang="en"> <head> <met ...

  4. dapr本地托管的服务调用体验与Java SDK的Spring Boot整合

    1 简介 之前在文章<dapr入门与本地托管模式尝试>中介绍了dapr和本地托管,本文我们来介绍如果在代码中使用dapr的服务调用功能,并把它整合到Spring Boot中. Dapr服务 ...

  5. JDK8 四大核心函数式接口及扩展接口总结

    前言 Java8的四大函数式接口及相关的扩展接口在日常使用中的频率也是非常多的,包括自己定义的函数式接口,在JDK1.8之前,我们定义的方法都是用来接收参数,然后自己根据参数传递实现逻辑.在1.8之后 ...

  6. 了解 Transformers 是如何“思考”的

    Transformer 模型是 AI 系统的基础.已经有了数不清的关于 "Transformer 如何工作" 的核心结构图表. 但是这些图表没有提供任何直观的计算该模型的框架表示. ...

  7. springboot自定义验证-传值范围

    package com.xf.common; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static ...

  8. 移除链表元素&反转链表&设计链表

    一.移除链表元素 203.移除链表元素 leetcode链接 1.方法概述 带傀儡节点的方法: 创建一个傀儡节点puppet来充当该链表的假头节点,当真正的头结点head不为null时,且在真正的头节 ...

  9. 谈谈Selenium中的三种切换之alert

    谈谈Selenium中的三种切换之alert 一.如何识别 识别方法:alert中的确定.取消.输入框无法用inspector定位到,当然还有一些特例. alert分为三种 alert confirm ...

  10. 删除resource中的图片后编译报错

    同僚的一篇文章是:https://www.cnblogs.com/jljxxf/archive/2012/08/19/2646937.html, 详细介绍了C#的Resources,其中关于删除资源这 ...