580A
#include <stdio.h> #include <string.h> #define MAXSIZE 100024//之前数据少开了一个量级 int money[MAXSIZE]; int main() { memset(money, 0, sizeof(money)); int a; scanf("%d", &a); int Thiscnt=1, Maxcnt=1;//如果Maxcnt=-1;那么当a为1的时候,for循环不会执行,进而导致输入结果为-1(出错)。 int i; int cnt=0; scanf("%d", &money[0]); for(i=0; i<(a-1); ++i) { ++cnt; scanf("%d", &money[i+1]); //printf("i+1=%d,money[%d]=%d ", i+1, i+1, money[i+1]); if(money[i]<=money[i+1]) //a[i];a[i-1] is wrong.money[i-1] is wrong. { ++Thiscnt; //printf("cnt=%d:Thiscnt=%d\n", cnt, Thiscnt); } else Thiscnt=1; if(Thiscnt>Maxcnt) Maxcnt=Thiscnt; } printf("%d\n", Maxcnt); return 0; }
580A的更多相关文章
- Codeforces 580A - Kefa and First Steps
580A - Kefa and First Steps 思路:dp dp[i]表示包括前i个元素中a[i]在内的最大增序列. 代码: #include<bits/stdc++.h> usi ...
- Codeforces Round #321 (Div. 2) A, B, C, D, E
580A. Kefa and First Steps 题目链接: A. Kefa and First Steps 题意描述: 给出一个序列,求最长不降连续子序列多长? 解题思路: 水题,签到 代码: ...
随机推荐
- 华为S12700 NQA配置
首先,nqa功能是需要授权的. 以下以ICMP配置方式示例: 在配置ICMP测试之前,需要NQA客户端与被测试设备间路由可达.(ICMP测试提供类似于普通ping命令的功能,但输出信息更为丰富.) 请 ...
- [转]$.post() 和 $.get() 如何同步请求
原文地址:https://blog.csdn.net/sunnyzyq/article/details/78730894 由于$.post() 和 $.get() 默认是 异步请求,如果需要同步请求, ...
- [转]spring MultipartFile 转 File
原文地址:https://www.jianshu.com/p/6cf99d39e170 File.createTempFile(String prefix, String suffix); 创建一个临 ...
- tun/tap设备_虚拟网卡
tun/tap 驱动程序实现了虚拟网卡的功能,tun表示虚拟的是点对点设备,tap表示虚拟的是以太网设备,这两种设备针对网络包实施不同的封装.利用tun/tap 驱动,可以将tcp/ip协议栈处理好的 ...
- [mvc] 简单的forms认证
1.在web.config的system.web节点增加authentication节点,定义如下: <system.web> <compilation debug="tr ...
- C# 在while循环中new的对象
一: 问:那每次循环都会new一个A?那内存不是会满吗?还是说要把这个初始化对象的动作放到循环外面的写法会比较好? while(true) { A a = new A(); ... sleep(100 ...
- python 记录linux网速到文件。
import timefrom app.utils_ydf import LogManager logger = LogManager('network_monitor').get_logger_an ...
- ubuntu16.04英文版搜狗输入法安装报错
1.因为是英文版的,所以需要更新中文字体 Systems Settings>Language Support ,会提示自动更新,这个时候KeyBorad input method 选择不了fci ...
- linux下vi或vim操作Found a swap file by the name的原因及解决方法
在linux下用vi或vim打开Test.java文件时 [root@localhost tmp]# vi Test.java出现了如下信息: E325: ATTENTION Found a s ...
- Android学习:Notification状态栏通知
Notification是显示在手机状态栏的通知,它代表一种具有全局效果的通知,程序一般通过NotificationManager服务来发送Notification.在小米手机上,手指在屏幕顶端向下划 ...