Notice: Undefined index: name in /usr/www/lib/views/home/viewtitle.html on line 188
-阅读程序 第 21 题
#include<iostream>
#include<vector>
int cmp(int x, int y)
{
	if(x>y)return 1;
	else if(x==y)return 0;
	else return -1;
}
int main()
{
	int n;
	std::cin>>n;
	std::vector<int> a(n+5);
	for(int i=1; i<=n; i++)
		std::cin>>a[i];
	int now=-1;
	for(int i=2; i<=n; i++)
	{
		int c=cmp (a[i-1],a[i]);
		if (c>=now) now=c;
		else
		{
			std::cout<<"NO"<<std::endl;
			return 0;
		}
	}
	std::cout<<"YES" <<std::endl;
	return 0;
}
● 判断题
第 1 题 如果输入满足 1≤n≤100, 1≤a[i]≤1000 (下同),则程序只会输出YES或NO两种结果。( )
第 2 题 cmp函数的作用是比较两个数x,y的大小,如果x较大返回-1,如果y较大返回1,如果一样大返回0。( )
第 3 题 该程序的时间复杂度为0(n)。 ( )
● 单选题
第 4 题 输入为( ) 时输出为YES。
第 5 题 如果将第24行去掉,这时输出中最多包含( )个大写字母 0。

解答部分以后会开放。