problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
luogu::P1420类 参考

洛谷 P1420 最长连号 更多...

#include <luogu.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

洛谷 P1420 最长连号

在文件 luogu.h331 行定义.

成员函数说明

◆ main()

int luogu::P1420::main ( istream &  cin,
ostream &  cout 
)
static

在文件 luogu.cpp978 行定义.

978 {
979 unsigned int n;
980 cin >> n;
981 unsigned int prev;
982 cin >> prev;
983 unsigned int a;
984 unsigned int len = 1;
985 unsigned int ans = 1;
986 for(unsigned int i = 1; i < n; i++, prev = a, ans = max(ans, len)) {
987 cin >> a;
988 if(a == prev + 1) {
989 len++;
990 } else {
991 len = 1;
992 }
993 }
994 cout << ans;
995 return 0;
996 }

被这些函数引用 luogu::TEST().


该类的文档由以下文件生成: