引言:CSP(http://www.cspro.org/lead/application/ccf/login.jsp)是由中国计算机学会(CCF)发起的"计算机职业资格认证"考试,针对计算机软件开发、软件测试、信息管理等领域的专业人士进行能力认证。认证对象是从事或将要从事IT领域专业技术与技术管理人员,以及高校招考研究生的复试对象。 问题描述 在一个整数序列a1, a...
System.out.println(res);elseSystem.out.println(-1); sc.close(); } }
3 4 6 7样例输出-1样例说明在序列中的4个数都不满足中间数的定义。样例输入5 3 4 6 6 7样例输出-1样例说明在序列中的5个数都不满足中间数的定义。评测用例规模与约定对于所有评测用例,1 ≤ n ≤ 1000,1 ≤ ai≤ 1000。 问题描述:首先输入正整数n,接着输入n个正整数,如果存在一个数,比该数大或比...
sort(arr.begin(), arr.end());intnum = arr[N/2];intcntSmall =0;intcntBig =0;for(intn=0; n<N; n++) {if(arr[n] < num) cntSmall++;if(arr[n] > num) cntBig++; }if(cntSmall==cntBig) cout <<num;elsecout << -1; }...
//得分100#include using namespace std; int main(){ int n; cin>>n; int* a=new int[n]; for(int i=0;i>a[i]; int result=-1; for(int j=0;ja[k]) lcou
CCF CSP 201612-1 中间数 题目链接:http://118.190.20.162/view.page?gpid=T52 问题描述 试题编号: 201612-1 试题名称: 中间数 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 在一个整数序列a1, a2,…, an中,如果存在某个数,大于它的整数数量等于小于它的整数数量,则称其为中间数。在一个序列...