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:(不是我写 ...
随机推荐
- Kali Win-KeX Win
内容: 概述 用法 开始 启动根会话 会话管理 声音支持 多屏支持 停止 概述 窗口模式下的 Win-KeX 将在单独的窗口中运行 Kali Linux 桌面会话. 窗口模式有助于在视觉上将 Wind ...
- [常用工具] cvat安装与使用指北
cvat是一个非常好用的标注工具,但是也是非常难以安装的标注工具,所以本文简单讲一讲如何安装与使用cvat.cvat最好在ubuntu18.04安装,windows平台安装难度很大,然后在其他平台使用 ...
- [OpenCV实战]16 使用OpenCV实现多目标跟踪
目录 1 背景介绍 2 基于MultiTracker的多目标跟踪 2.1 创建单个对象跟踪器 2.2 读取视频的第一帧 2.3 在第一帧中确定我们跟踪的对象 2.4 初始化MultiTrackerer ...
- 《STL源码剖析》STL的双层配置器
SGI STL第一级配置器: template<int inst> class __malloc_alloc_template{...}; 其中: 1.allocate()直接使用mall ...
- UVA12412 A Typical Homework (a.k.a Shi Xiong Bang Bang Mang) 代码
#include <bits/stdc++.h> #define int long long #define judge(a,func) case a:func();break; usin ...
- Mac上优秀的虚拟机软件推荐 PD Parallels Desktop 18.1.1
APPERK 软件信息 软件名称 ParallelsDesktop 版本号 18.1.1 软件类型 官网版 + 商业版 安装包大小 390MB 语言 中文 系统支持 macOS11及以上(M芯片原生) ...
- Python博客导航
第一部分 - Python程序设计基础 第一章 - Python介绍 1.1 - Python简介 1.2 - Python准备 1.2 - 创建虚拟环境 第二章 - Python基础(建设中) 2. ...
- 洛谷 P1094纪念品分组 题解
一道典型的贪心算法题. 题目内容不多说了,大致说一下代码的思路: 给定的所有纪念品中可以先用sort排一下顺序,然后从价格最高和最低的开始向中间靠拢(可以看做是指针),这样保证每组的搭配都是最优的. ...
- angular---angular路由守卫,有的可以访问有的不可以访问,有的路由地址只有在满足条件时候访问,其它禁止访问,
- 字节输出流的续写和换行-字节输入流_inputS Stream类
字节输出流的续写和换行 package demo02.OutputStream; import java.io.FileOutputStream; import java.io.IOException ...