一、选择题(每题4分,共40分)

1 答案:C

2 答案:B

3 答案:C

4 答案:A

5 答案:C

6 答案:D

7 答案:A

8 答案:B

9 答案:C

10 答案:D

二、填空题(每题8分,共40分)

1 答案:8

2 答案:5:9

3 答案:4

4 答案:37

5 答案:True

三、程序完善题(每空2分,共20分)

1

#include<iostream>
using namespace std;
int main()
{
    int n, i;
    cout << "请输入整数:";
    cin >> n;
    cout<<"n=";
    for(i=2; i<=n; i++)
    {
        //判断是否被整除
        while(n % i == 0)
        {
            cout << i;
            n /= i;
            if(n!=1) cout << '*';
        }
    }
    return 0;
}

2

#include<iostream>
using namespace std;
int a, b, n, h;

int main()
{
	cin >> a >> b >> n;
	int d = 1;		//初始化天数
	h = a;			//初始化青蛙爬了的高度
	while (h < n)   //小青蛙没有爬出井的时候
    {
		h -= b;		//晚上下滑b米
		d ++;		//天数增加
		h += a;		//白天向上爬a米
	}
	cout << d;
	return 0;
}

四、编程题(每题100分,共200分)

1

#include <iostream>
using namespace std;

double n, t;

int main()
{
    int cnt = 0;
    cin >> n;
    do
    {
        cnt++;
        if(cnt & 1) //通讯员从A往B
        {
            t = n / 68;
        }
        else    // 通讯员从B往A
        {
            t = n / 70;
        }
        n -= 18 * t;
    }while(n >= 0.5);

    cout << cnt;

    return 0;
}

2

//Author: Theo
#include <iostream>
using namespace std;

int mx = INT_MIN, mn = INT_MAX;

int main()
{
    int n, sum = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        mx = max(x, mx);
        mn = min(mn, x);
        sum += x;
    }
    double ans = ((sum - mx - mn) * 1.0) / (n - 2.0);
    printf("%.2lf\n", ans);
    return 0;
}
Logo

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。

更多推荐