#O3800. LQ.蓝桥杯.十五届.省赛.理论题

LQ.蓝桥杯.十五届.省赛.理论题

选择题(选择题严禁使用程序验证,选择题不答或答错都不扣分)

  1. 定义 char a[]="hello\nworld" ,执行 cout<<a,输出结果是( ) {{ select(1) }}
  • helloworld
  • hello
    world
  • hellonworld
  • hello\nworld
  1. (11001010)2+(F8)16(11001010)_2 + (F8)_{16} 的结果是( )。{{ select(2) }}
  • (11001010)2(11001010)_2
  • (701)8(701)_8
  • (1C2)16(1C2)_{16}
  • (452)10(452)_{10}
  1. 表达式 4%12 的结果是( ) {{ select(3) }}
  • 0
  • 4
  • 3
  • 12
  1. 下列选项中,逻辑表达式的值始终与 B 的真假无关的是( )。 {{ select(4) }}
  • ( !A || B ) && A
  • ( A || B ) && (!A && B)
  • ( A && !A ) || B
  • ( A || B ) && ( A | !B)
  1. 运行下面的程序,输出的结果是( )。
#include<iostream>
using namespace std;
int a[6]={16, 8,32,10,9, 21};
int func(int L, int R, int d){
    if(L > R) return 0;
    int sum=0, m = a[L],index = L;
    for(int i=L+1;i<= R; i++)
    {
        if(m < a[i])
        {
            m= a[i]; index= i;
        }
    }
    int lt = func(L, index - 1, d + 1);
    int rt = func(index+1, R, d + 1);
    return lt + rt + d * m;
}

int main(){
    cout<<func(0,5,1);
    return 0;
}

{{ select(5) }}

  • 196
  • 197
  • 198
  • 199