2015年全国青少年信息学奥林匹克竞赛NOIP普及组初赛试卷
剩余时间 --:--:--
单选题 共 20 题
1.

1MB 等于( )

2.

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

3.

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

4.

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

5.

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

6.

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

7.

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

8.

链表不具备的特点是( )

9.

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

10.

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

11.

FTP 可以用于( )

12.

计算机病毒是( )。

13.

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

14.

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

15.

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

16.

下列说法正确的是( )。

17.

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

18.

操作系统的作用是( )

19.

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

20.

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

填空题 共 8 题
1.

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

2.

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

3.
#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;
}

输出:_________

4.
#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.

输出:_________

5.
#include <iostream> 
using namespace std; 
struct point {
    int x;
    int y; 
    };
    int main() {
       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;
}

输出:_________

6.
#include <iostream>
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;
}

输出:_________

7.

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

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

#include <iostream>
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 制表符
    (1) ;
    for (i = 1; i < m; i++) 
        offset= (2) ;
    for (i = 0; i < offset; i++) 
        cout << '\t';
    for(i=1;i<= (3) ;i++){
        cout<< (4) ;
        if (i == dayNum[m] || (5) == 0)
            cout << endl;
        else
            cout << '\t';
        }
    return 0; 
}
8.

(中位数)给定 n(n 为奇数且小于 1000)个整数,整数的范围在 0~m(0 < m < 231) 之间,请使用二分法求这 n 个整数的中位数。所谓中位数,是指将这 n 个数排序之后, 排在正中间的数。

#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 ( (1) ) {
        mid = (lbound + rbound) / 2; 
        (2) ;
        for (i = 0; i < n; i++)
            if( (3) )
            (4) ;
        if (count > n / 2)
               lbound = mid + 1;
        else
            (5) ;
     }
     cout << rbound << endl;
     return 0;
}
C++ 编辑器
输入
输出