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:(不是我写 ...
随机推荐
- 使用nodejs编写api接口并部署到服务器上
一.用node.js编写api接口 1.安装node环境,没有就去下载nodejs, 下载地址 2.创建一个node项目, 新建一个目录文件,例node_proxy 3.在新建的node项目执行npm ...
- RestTemplate获取json数组
1.需求描述 接口返回的是一个json数组,要获取到接口返回值并用实体类list接住. 2.解决方法 使用springboot框间自带的Http的工具类RestTemplate调接口,其返回值用hut ...
- 2022USACO-DEC-Silver
题目链接 T1.Barn Tree T2.Circular Barn T3.Range Reconstruction T1 下面均以\(1\)为根来进行分析. 算法思路: 首先,定义一个数组dis表示 ...
- Shiro-721反序列化漏洞
漏洞名称 Shiro-721(Apache Shiro Padding Oracle Attack)反序列化 利用条件 Apache Shiro < 1.4.2 漏洞原理 Apache Shir ...
- 上传图片文件并立即显示到页面使用 javascript实现鼠标拖动画矩形框以及实现固定区域内随意拖动
首先,你要设计好鼠标事件处理方法,主要是鼠标左键点击,左键释放,还有鼠标移动方法其次,要了解容什么方式,画一个矩形,设计一个方法:DrawRectgle(左上角,右下角),并且要确定当调用这个方法时, ...
- try catch finally,try里有return,finally还执行么?
执行,并且finally的执行早于try里面的return: 结论: 1.不管有木有出现异常,finally块中代码都会执行: 2.当try和catch中有return时,finally仍然会执行: ...
- Ubuntu 22.04 GCC Arm 12.2.rel1编译 DAPLink
ARMmbed / DAPLink 项目 仓库地址 https://github.com/ARMmbed/DAPLink Arm Mbed 应该属于Arm的机构或者是Arm资助的机构. 常用的 DAP ...
- avalonia实现自定义小弹窗
对于使用avalonia的时候某些功能需要到一些提示,比如异常或者成功都需要对用户进行提示,所以需要单独实现弹窗功能,并且可以自定义内部组件,这一期将手动实现一个简单的小弹窗,并且很容易自定义 创建项 ...
- vue学习笔记(一)---- vue指令(在vue中使用样式的方式)
认真学习,认真记录,每天都要有进步呀!!! 加油叭!!! 一.在vue中使用样式的方式: 1. 直接传递一个数组,注意: 这里的 class 需要使用 v-bind 做数据绑定 <style&g ...
- 亲测有效 Hyper V3.4.0 终端美化工具 支持win/mac
亲测有效 Hyper V3.4.0 终端美化工具 支持win/mac Hyper 是一款终端美化工具 基于Web技术,JS/HTML/CSS ,支持扩展增强,很不错! 且支持win,mac 下载地址 ...