zoukankan      html  css  js  c++  java
  • 2020年全国高校计算机能力挑战赛Python程序设计初赛

    ######说明:答案仅提供参考

    部分选择题:

    1、Python在内存中存储了每个对象的引用计数(reference count)。如果计数值变成0,关于相应的对象会发生变化,描述错误的是?(B)

      A. 相应的对象消失

      B. 相应的对象仍然存在

      C. 分配给该对象的内存会释放出来

      D. 相应的对象占用的空间会移交给操作系统

    2、在Unix系统中,以下关于可执行Python脚本文件说法正确的是?(A)

      A. 脚本文件的模式必须是可执行的

      B. 第一行必须以#(#!/usr/local/bin/python)开头

      C. 脚本文件都可以直接执行

      D. 以上说法都不正确

    4、以下英文单词中,不是Python保留字的是(A)

      A. do

      B. finally

      C. with

      D. in

    8、以下哪个函数可以随机化列表中的元素(C)

      A. init

      B. new

      C. random

      D. shuffle

    10、以下哪个不是Python语言的标准库(D)

      A. datetime

      B. random

      C. sys

      D. graph

    13、在Python中,a=0011 1100,b=0000 1101,表达式a&b的结果是(A)

      A. 0000 1100

      B. 0011 1101

      C. 0011 0001

      D. 1100 0011

    所有大题:

    a,b = input().strip().split()
    count = 0
    x_ = [-1,-1,-1]
    for i in range(int(a)+1,int(b)):
        if i*2 % 5 ==0:
            x_[count] = i
            count += 1
        if count > 2:
            break
    print(x_[0],x_[1],x_[2])

     

    a,b = input().split()
    x = list(map(int,input().split()))
    temp_max = x[0]*x[1]*x[2]
    temp_index = 0
    for i in range(0,len(x)-2):
        v = x[i] * x[i + 1] * x[i + 2]
        if v > temp_max:
            temp_max = v
            temp_index = i
    print(temp_max,temp_index+1)
    

     

    str1 = input()
    judge = "_1234.exe"
    count = 0
    num_list = []
    for i in range(0,len(str1)-len(judge)+1):
        if str1[i:i+len(judge)] == judge:
            count += 1
            num_list.append(i)
    
    if count == 0:
        print(count)
    else:
        print(count,end=" ")
        for j in num_list:
            print(j,end=" ")

    n = int(input().strip())
    metrix = []
    for i in range(n):
        metrix.append(list(map(int,input().strip().split())))
    
    length = 0
    I = -1
    J = -1
    tag = 0
    for j in range(1,n-1): #遍历每一行
        temp_length = 0
        temp_i = -1
        temp_j = -1
        for k in range(n): #遍历每一列
            if metrix[j][k] > metrix[j-1][k] and metrix[j][k] > metrix[j+1][k]:
                temp_length += 1
                temp_i = j
                temp_j = k
                if temp_length > length:
                    length = temp_length
                    I = temp_i
                    J = temp_j
                    tag = 1 #标记更新
            else:
                temp_length = 0
                temp_i = -1
                temp_j = -1
        if tag == 1:
            J = J - length + 1
            tag = 0
    
    for j in range(1,n-1): #遍历每一列
        temp_length = 0
        temp_i = -1 #代表行
        temp_j = -1 #代表列
        for k in range(n): #遍历每一行
            if metrix[k][j] > metrix[k][j-1] and metrix[k][j] > metrix[k][j+1]:
                temp_length += 1
                temp_i = k
                temp_j = j
                if temp_length > length:
                    length = temp_length
                    I = temp_i
                    J = temp_j
                    tag = 1
            else:
                temp_length = 0
                temp_i = -1
                temp_j = -1
        if tag == 1:
            I = I - length + 1
            tag = 0
    
    if length == 0:
        print(0,-1,-1)
    else:
        print(length,I+1,J+1)
  • 相关阅读:
    MP3/4维修全攻略
    看图学维修mp3之电源篇65Z8\65Z5
    CSS按钮样式之button标签与input type=button的区别详解
    【原】PNG的使用技巧
    【原】[webkit移动开发笔记]之禁止触发系统默认菜单
    【原】使用iScroll.js解决ios4下不支持position:fixed的问题
    【原】YUI压缩与CSS media queries下的bug
    【翻译】Building a Simple Blog Engine with ASP.NET MVC and LINQ Part 2
    【翻译】Building a Simple Blog Engine with ASP.NET MVC and LINQ Part 4
    .NET技术书籍推荐
  • 原文地址:https://www.cnblogs.com/yuncaige/p/14061105.html
Copyright © 2011-2022 走看看