2015年信息学奥赛NOIP普及组
剩余时间 --:--:--
单选题 共 20 题
1.

下面哪种软件不属于即时通信软件( )。

2.

计算机病毒是( )。

3.

在PC机中,PENTIUM(奔腾)、酷睿、赛扬等是指( )。

4.

下列选项中不属于视频文件格式的是( )。

5.

所谓的“中断”是指( )。

6.

与二进制小数0.1相等的十六进制数是( )。

7.

线性表若采用链表存储结构,要求内存中可用存储单元地址( )。

8.

操作系统的作用是( )。

9.

在NOI系列赛事中参赛选手必须使用累承办单位统一提供的设备。下列物品中不允许选手自带的是( )。

10.

设某算法的计算时间表示为递推关系式T(n)=T(n-1)+n(n为正整数)及T(0)=1,则该算法的时间复杂度为( )。

11.

下列说法正确的是( )。

12.

二进制数00100100和00010100的和是( )。

13.

6个顶点的连通图的最小生成树,其边数为( )。

14.

今有一空栈S,对下列待进栈的数据元素序列a,b,c,d,e,f依次进行进栈,进栈,出栈,进栈,进栈,出栈的操作,则此操作完成后,栈S的栈顶元素为( )

15.

链表不具备的特点是( )。

16.

1MB等于( )。

17.

在计算机内部用来传送、存贮、加工处理的数据或指令都是以( )形式进行的。

18.

前序遍历序列与中序遍历序列相同的二叉树为( )。

19.

如果根的高度为1,具有61个结点的完全二叉树的高度为( )。

20.

FTP可以用于( )。

填空题 共 2 题
1.

重新排列1234使得每一个数字都不在原来的位置上,一共有              种排法。

2.

一棵结点数为 2015 的二叉树最多有                个叶子结点。

编程题 共 6 题
1.
#include <iostream>

using namespace std;

int main()

{
	int a, b, c;
	a = 1;
	b = 2;
	c = 3;
	if(a > b)
		if(a > c)
			cout << a << ' ';
		else
			cout << b << ' ';
	cout << c << endl;
	return 0;
}

输出:                     

2.
#include <iostream>

using namespace std;

struct point
	{
		int x;
		int y;
	};

int main()
	{
		int a, b, c;
		struct EX
			{
				int a;
				int b;
				point c;
			}e;
	e.a = 1;
	e.b = 2;
	e.c.x = e.a + e.b;
	e.c.y = e.a * e.b;
	cout << e.c.x << ',' << e.c.y << endl;
	return 0;
}

输出:                       

3.
#include <iostream>
#include <string>

using namespace std;

int main()
	{
		string str;
		int i;
		int count;
		count = 0;
		getline(cin, str);
		for(i = 0; i < str.length(); i++)
			if(str[i] >= 'a' && str[i] <= 'z')
				count++;
		cout << "It has " << count << " lowercases" << endl;
		return 0;

输入: NOI2016 will be held in Mian Yang.

输出:                                                 

4.
#include <iostream>
#include <string>

using namespace std;

void fun(char *a, char *b)
	{
		a = b;
		(*a)++;
	}

int main()
	{
		char c1, c2, *p1, *p2;
		c1 = 'A';
		c2 = 'a';
		p1 = &c1;
		p2 = &c2;
		fun(p1, p2);
		cout << c1 << c2 << endl;
		return 0;
	}

输出:              

5.

完善程序:(中位数 median)给定 n(n 为奇数且小于 1000)个整数, 整数的范围在 0~m(0<m<2^31)之间, 请使 用二分法求这 n 个整数的中位数。所谓中位数,是指将这 n 个数排序之后,排在正中间的数。 (第五空 2分,其余 3 分)

#include <iostream>


using namespace std;


const int MAXN = 1000;

int n, i, lbound, rbound, mid, m, count;

int x[MAXN];


int main()

{

cin >> n >> m;

for(i = 0; i < n; i++)

cin >> x[i];

lbound = 0;

rbound = m;

while(       ⑴          )

{

mid = (lbound + rbound) / 2;

                             ⑵       ;

for(i = 0; i < n; i++)

if(     ⑶       )

                                                 ⑷       ;

if(count > n / 2)

lbound = mid + 1;

else

                                       ⑸        ;

cout << mid << " " << lbound << " " << rbound << " " << count << endl;

}

cout << rbound << endl;

return 0;

}

6.

完善程序: (打印月历)输入月份 m(1≤m≤12),按一定格式打印 2015 年第 m 月的月历。 (第三、四空 2.5 分,其余 3 分)

例如,2015 年 1 月的月历打印效果如下(第一列为周日):


#include <iostream>

#include <string>


using namespace std;


const int dayNum[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int m, offset, i;


int main()

{

cin >> m;

cout << "S\tM\tT\tW\tT\tF\tS" << endl;  //'\t'为 TAB 制表符

                         ⑴        ;

for(i = 1; i < m; i++)

offset =      ⑵      ;

for(i = 0; i < offset; i++)

cout << '\t';

for(i = 1; i <=     ⑶     ; i++)

{

cout <<    ⑷    ;

if(i == dayNum[m] ||    ⑸   == 0)

cout << endl;

else

cout << '\t';

}

return 0;

}

C++ 编辑器
输入
输出