codeforces 580A(Kefa and First Steps) Java
来源:互联网 发布:真正的挂机软件 编辑:程序博客网 时间:2024/06/06 01:58
出去浪了一段时间,回来继续虐水题!!!
import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.IOException;import java.io.InputStreamReader;import java.io.OutputStreamWriter;import java.io.PrintWriter;import java.io.StreamTokenizer;/** * 题意:求连续的最长非递减子序列 * * @author TinyDolphin * 2017/7/2 15:31. */public class Main { public static void main(String[] args) throws IOException { StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int inputN; int beforeNum; int afterNum; int count; int maxCount; while (in.nextToken() != StreamTokenizer.TT_EOF) { inputN = (int) in.nval; in.nextToken(); beforeNum = (int) in.nval; maxCount = Integer.MIN_VALUE; count = 1; while (inputN-- != 1) { in.nextToken(); afterNum = (int) in.nval; if (beforeNum <= afterNum) { count++; } else { maxCount = maxCount > count ? maxCount : count; count = 1; } beforeNum = afterNum; } //预防只有一个输入数(如:1)和只有一个非递减子序列(如:1,3,4)的情况 out.println(maxCount > count ? maxCount : count); } out.flush(); }}
阅读全文
0 0
- codeforces 580A(Kefa and First Steps) Java
- CodeForces 580A Kefa and First Steps
- Codeforces 580A Kefa and First Steps
- Codeforces-580A-Kefa and First Steps
- CodeForces 580A Kefa and First Steps
- codeforces 580A Kefa and First Steps
- codeforces 580A Kefa and First Steps
- coderforce 580A Kefa and First Steps
- Codeforces Kefa and First Steps
- Code Forces 580 A. Kefa and First Steps(水~)
- A. Kefa and First Steps
- Codeforces Round #321 (Div. 2) A. Kefa and First Steps
- Codeforces Round #321 (Div. 2) A. Kefa and First Steps
- Codeforces Round #321 A Kefa and First Steps
- Codeforces Round #321 (Div. 2) 580A Kefa and First Steps(模拟)
- 580A. Kefa and First Steps (Codeforces Round #321 (Div. 2))
- Codeforces Round #321 (Div. 2) 580A. Kefa and First Steps
- Kefa and First Steps
- ODI Studio 11g 连接Essbase数据源
- python3.6下opencv的开发环境搭建
- cin cin.get() cin.getline() 2017年7月2日学习记录
- 【6月英语总结】
- CDOJ-1592 (2017 UESTC Training for Data Structures B)
- codeforces 580A(Kefa and First Steps) Java
- 可视化日历程序
- java泛型详解
- 高手速成android开源项目【导航篇】
- 深搜最优解
- 《Advanced Bash-scripting Guide》学习(十一):shift的用法
- 数学算法:Poweroj2461-入门基础之二分答案(二分法的应用)
- linux安装vmtools
- HDU 5909 Tree Cutting [树形dp+FWT]【动态规划+数学】