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. 解决多次重连rabbitMQ失败

    项目中有用到rabbitMQ,但由于防火墙原因只有在SIT环境下才能连上rabbitMQ,在本地是无法连上rabbitMQ的.如下: 为了不影响调试,临时解决方法为禁止rabbitMQ打印日志.在lo ...

  2. 3xx HTTP状态码的终极指南

    前言 如果你在管理一些网站,那么对HTTP重定向的理解对于可靠的网站性能至关重要.在这篇文章中,我们将全面了解一下3xx HTTP状态码,从这里你可以了解它们是如何工作的,如何更好地管理它们,以及它们 ...

  3. 让 Win8.1 微软拼音新体验模式支持 Metro 应用

    内容回顾: [1]十个步骤找回 Win8 中的微软拼音新体验模式 [2]发布个工具,一键恢复Win8/8.1中的微软拼音长句模式(新体验模式) 在 [1] 中,我们找回了 Win8 里的微软拼音新体验 ...

  4. 2023 年该学点什么技术?「GitHub 热点速览 v.23.03」

    春节期间,小鱼干读了一篇万字回顾数据库行业的文章,在文字缝隙里我看见了两个词:AI+ 和数据两个词(当然数据是废话,毕竟是一个数据库的回顾文).在 GitHub 上热点趋势上,可见到 AI+ 的身影, ...

  5. 标准if-else语句-扩展if-else语句

    标准if-else语句 if语句第二种格式: if...else if(关系表达式) { 语句体1; }else { 语句体2; } 执行流程 首先判断关系表达式看其结果是true还是false 如果 ...

  6. 读Java8函数式编程笔记08_测试、调试和重构

    1. Lambda表达式的单元测试 1.1. 单元测试是测试一段代码的行为是否符合预期的方式 1.2. Lambda表达式没有名字,无法直接在测试代码中调用 1.2.1. 将Lambda表达式放入一个 ...

  7. 转载:SQL分页查询总结

    [转载]SQL分页查询总结 开发过程中经常遇到分页的需求,今天在此总结一下吧.    简单说来方法有两种,一种在源上控制,一种在端上控制.源上控制把分页逻辑放在SQL层:端上控制一次性获取所有数据,把 ...

  8. C-04\IDE基础知识和分支,循环语句

    一.浮点数特性及比较方法 浮点数在多参数传参的时候默认是会进行精度转换,由float转换到double,浮点数是一个近视值,不能进行直接等于比较,一般可以用区间法比较但是会存在精度丢失的问题. 浮点数 ...

  9. P22_条件渲染

    条件渲染 wx:if 在小程序中,使用 wx:if="{{condition}}" 来判断是否需要渲染该代码块: 也可以用 wx:elif 和 wx:else 来添加 else 判 ...

  10. 学习Java Day8

    今天学习了for循环,与C语言几乎无差异: 也学习了while和do while循环 今天学习了for循环,与C语言几乎无差异: 也学习了while和do while循环