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:(不是我写 ...
随机推荐
- java反射基础知识整理
目录 1.反射机制的作用 2.获取一个类的实例 3.使用Class.forName()方法加载类的静态代码块 4.获取配置文件的路径 5.java反编译 5.1.获取类中的成员变量 5.2.通过类名反 ...
- Shiro-721反序列化漏洞
漏洞名称 Shiro-721(Apache Shiro Padding Oracle Attack)反序列化 利用条件 Apache Shiro < 1.4.2 漏洞原理 Apache Shir ...
- 过年必备!亲戚计算器「GitHub 热点速览 v.23.02」
过完这周大家就要开始为期 7 天的春节长假了,当然有些 HG 小伙伴拥有了 10+ 天的长假就低调点不要告诉他人,以免招人妒忌.春节必经的事情可能就是走亲戚了,所以本周特推选取了一个研究亲戚关系的资深 ...
- 算法之倍增和LCA:论点与点之间的攀亲戚
前言 我们在做树形题和图论题时常常遇到这样的问题:要求求出树上两点间的最近公共祖先(LCA),这时我们该怎么办? 思路一:暴力爬爬爬-- 很容易想到让两个点都往上爬,啥时候相遇了就是他们的最近公共祖先 ...
- Ubuntu 配置 Oh-my-zsh
注意 oh-my-zsh 这玩意安装简单.卸载难.维护极其繁琐,动不动就报错.体验一下还可以,我个人建议能不装就不装. 下载 zsh sudo apt install zsh 下载 oh-my-zsh ...
- angular Ionic CLI环境搭建安装以及栅格响应式布局
- C#开发PACS医学影像三维重建(十四):基于能量模型算法将曲面牙床展开至二维平面
在医学影像领域中,将三维重建中的人体组织展开平铺至二维,用来研判病灶和制定治疗方案的重要手段之一, 它能够将立体曲面所包含的信息更为直观的展示到二维平面上,常用的情景包括: 牙床全景图.平铺血管.骨骼 ...
- File的概述-File类的静态成员变量
File的概述 java.io.File类是文件和目录路径名的抽象表示,主要用于文件和目录的创建.查找和删除等操作. 构造方法 public File(String pathname)︰通过将给定的路 ...
- k8s部署canal-1.1.6版本实现MySQL数据库数据同步
1.版本说明 软件&镜像 版本&镜像信息 说明 Kubernetes v1.23.7 k8s服务器 Kuboard v3.5.2.0 k8s连接管理工具 Canal v1.1.6 数据 ...
- XMind 2022 安装教程 (11-30亲测有效)
下载地址 下载直通车:立即下载 解压文件 鼠标右击[XMind2022(64bit)]压缩包(win11系统需先点击"显示更多选项")选择[解压到 XMind2022(64bit) ...