蓝桥杯 省赛 试题 D: REPEAT 程序 多种解法(替换/正则)

试题 D: REPEAT 程序

  大家好,我叫亓官劼(qí guān jié ),在CSDN中记录学习的点滴历程,时光荏苒,未来可期,加油~博主目前仅在CSDN中写博客,唯一博客更新的地址为:亓官劼的博客

本文原创为亓官劼,请大家支持原创,部分平台一直在恶意盗取博主的文章!!!


本题总分:10 分

【问题描述】

附件 prog.txt 中是一个用某种语言写的程序。

其中 REPEAT k 表示一个次数为 k 的循环。循环控制的范围由缩进表达,

从次行开始连续的缩进比该行多的(前面的空白更长的)为循环包含的内容。

例如如下片段:

REPEAT 2:

 A = A + 4

 REPEAT 5:

  REPEAT 6:

   A = A + 5

  A = A + 7

 A = A + 8

A = A + 9

该片段中从 A = A + 4 所在的行到 A = A + 8 所在的行都在第一行的

循环两次中。

REPEAT 6: 所在的行到 A = A + 7 所在的行都在 REPEAT 5: 循环中。

A = A + 5 实际总共的循环次数是 2 × 5 × 6 = 60 次。

请问该程序执行完毕之后,A 的值是多少?

【答案提交】

这是一道结果填空题,你只需要算出结果后提交即可。本题的结果为一个

整数,在提交答案时只填写这个整数,填写多余的内容将无法得分。

试题D 题解一:转换

这题附件中的完整程序在:试题D附件程序

这题是填空题,所以我们还是可以使用Python来进行处理,可以方便点,当前,C/C++也是可以的,这里提供一个Python版本的处理方法

dir = '/Users/qiguan/Downloads/C++大学B组/REPEAT程序.txt'
file = open(dir)
data = file.read()
len = data.__len__()


def get_indent(i):
    now_indent = 0
    while data[i] == ' ':
        now_indent = now_indent + 1
        i = i + 1
    return now_indent, i


def get_flag(i):
    if data[i] == 'R':
        i = i + 7
        return 1, i
    if data[i] == 'A':
        i = i + 8
        return 2, i


# 当前处理中的行前缩进空格数
indent = 0
# 控制下标
i = 5
# A的值
A = 0
# 乘数
multiplier =  1
# 乘数 集合
multiplier_list = []
flag = 0
while i != len:
    if data[i] == '\n':
        i = i + 1
        if i >= len -1:
            break
        now_indent, i = get_indent(i)
        flag, i = get_flag(i)
        if now_indent < indent:
            multiplier /= multiplier_list[-1]
            multiplier_list.pop()
        if flag == 1:
            multiplier *= int(data[i])
            multiplier_list.append(int(data[i]))
            i += 2
        # A = A +
        if flag == 2:
            A += int(data[i])*multiplier
            i += 1
        indent = now_indent
print(A)

答案:241830

解法二:正则替换

这里面缩进正好也是Python的控制方法,我们可以使用正则将它替换为Python语句,然后执行即可。关键替换代码为:a为附件中的程序,下面有完整代码

a = re.sub("        REPEAT ","        for k in range(",a)
a = re.sub(":","):",a)
a = re.sub("    REPEAT ","    for j in range(",a)
a = re.sub("REPEAT ","for i in range(",a)

print(a)

包含a的完整程序为:

import re
a = """
A = 0
REPEAT 2:
    A = A + 4
    REPEAT 5:
        REPEAT 6:
            A = A + 5
        A = A + 7
    REPEAT 6:
        A = A + 7
        REPEAT 4:
            A = A + 2
            A = A + 7
        A = A + 2
    REPEAT 7:
        REPEAT 4:
            A = A + 8
            A = A + 7
            A = A + 4
            A = A + 5
        A = A + 8
    REPEAT 8:
        A = A + 5
        REPEAT 1:
            A = A + 2
        REPEAT 7:
            A = A + 5
        A = A + 5
    REPEAT 2:
        REPEAT 3:
            A = A + 1
        A = A + 1
    REPEAT 5:
        A = A + 1
    REPEAT 9:
        REPEAT 6:
            A = A + 5
            A = A + 1
        REPEAT 6:
            A = A + 2
            A = A + 8
            A = A + 3
        REPEAT 2:
            A = A + 5
        REPEAT 3:
            A = A + 9
        REPEAT 1:
            A = A + 4
        REPEAT 2:
            A = A + 9
        REPEAT 1:
            A = A + 6
            A = A + 6
            A = A + 4
        REPEAT 3:
            A = A + 7
        A = A + 1
        REPEAT 2:
            A = A + 3
        REPEAT 5:
            A = A + 2
            A = A + 5
            A = A + 2
        A = A + 4
    A = A + 3
REPEAT 4:
    A = A + 4
    A = A + 3
    A = A + 7
    REPEAT 5:
        REPEAT 4:
            A = A + 5
            A = A + 7
        REPEAT 5:
            A = A + 3
        REPEAT 3:
            A = A + 3
            A = A + 1
        A = A + 8
        A = A + 2
        REPEAT 9:
            A = A + 5
        REPEAT 1:
            A = A + 5
        A = A + 2
    A = A + 8
A = A + 6
REPEAT 3:
    REPEAT 4:
        A = A + 9
        REPEAT 5:
            A = A + 2
        A = A + 1
    REPEAT 9:
        A = A + 9
        A = A + 2
        REPEAT 1:
            A = A + 6
            A = A + 8
        REPEAT 2:
            A = A + 9
            A = A + 4
        A = A + 7
    REPEAT 2:
        REPEAT 7:
            A = A + 3
            A = A + 5
        REPEAT 3:
            A = A + 5
            A = A + 3
            A = A + 6
            A = A + 4
        REPEAT 9:
            A = A + 2
            A = A + 8
            A = A + 2
        A = A + 3
    REPEAT 2:
        REPEAT 8:
            A = A + 5
            A = A + 1
        A = A + 6
        A = A + 1
    A = A + 2
    REPEAT 6:
        REPEAT 1:
            A = A + 3
        REPEAT 1:
            A = A + 2
        REPEAT 4:
            A = A + 7
            A = A + 1
        A = A + 8
        REPEAT 6:
            A = A + 5
        REPEAT 6:
            A = A + 3
        REPEAT 2:
            A = A + 2
            A = A + 9
        A = A + 7
    REPEAT 9:
        A = A + 8
        REPEAT 9:
            A = A + 8
            A = A + 9
            A = A + 3
        A = A + 2
        REPEAT 6:
            A = A + 3
        REPEAT 9:
            A = A + 1
        A = A + 9
        A = A + 5
        REPEAT 2:
            A = A + 4
            A = A + 9
        A = A + 8
        REPEAT 5:
            A = A + 6
            A = A + 9
        A = A + 1
    REPEAT 1:
        A = A + 4
    A = A + 2
    REPEAT 9:
        REPEAT 3:
            A = A + 4
        REPEAT 7:
            A = A + 8
            A = A + 3
        REPEAT 5:
            A = A + 9
        REPEAT 8:
            A = A + 9
            A = A + 8
        REPEAT 4:
            A = A + 7
        A = A + 7
    A = A + 3
A = A + 5
REPEAT 6:
    A = A + 7
REPEAT 7:
    A = A + 2
    A = A + 2
A = A + 1
REPEAT 8:
    REPEAT 1:
        REPEAT 4:
            A = A + 6
            A = A + 6
            A = A + 2
        REPEAT 5:
            A = A + 4
            A = A + 8
            A = A + 4
        REPEAT 1:
            A = A + 5
        REPEAT 7:
            A = A + 8
        REPEAT 6:
            A = A + 4
        A = A + 4
        A = A + 8
        REPEAT 4:
            A = A + 2
        REPEAT 2:
            A = A + 4
        REPEAT 2:
            A = A + 3
        REPEAT 1:
            A = A + 2
        A = A + 8
        REPEAT 2:
            A = A + 7
        REPEAT 8:
            A = A + 6
            A = A + 1
        A = A + 7
    REPEAT 8:
        A = A + 2
    REPEAT 8:
        REPEAT 6:
            A = A + 1
            A = A + 6
        REPEAT 2:
            A = A + 4
            A = A + 1
        A = A + 7
    A = A + 4
REPEAT 4:
    REPEAT 9:
        A = A + 2
    REPEAT 1:
        A = A + 2
    A = A + 5
REPEAT 8:
    REPEAT 6:
        A = A + 3
    REPEAT 4:
        A = A + 1
        A = A + 6
        A = A + 1
    REPEAT 7:
        A = A + 7
        REPEAT 7:
            A = A + 3
            A = A + 9
            A = A + 1
            A = A + 9
        REPEAT 3:
            A = A + 5
        A = A + 5
        A = A + 6
        A = A + 2
    REPEAT 1:
        A = A + 4
    REPEAT 2:
        A = A + 7
    REPEAT 1:
        A = A + 7
        REPEAT 4:
            A = A + 7
        A = A + 2
        REPEAT 5:
            A = A + 9
            A = A + 1
            A = A + 9
            A = A + 5
            A = A + 9
        REPEAT 5:
            A = A + 5
        REPEAT 1:
            A = A + 6
        REPEAT 2:
            A = A + 3
            A = A + 2
            A = A + 6
            A = A + 8
            A = A + 8
            A = A + 7
        A = A + 5
    A = A + 5
REPEAT 2:
    A = A + 1
    A = A + 7
A = A + 3
REPEAT 2:
    A = A + 7
A = A + 1
A = A + 4
REPEAT 1:
    REPEAT 7:
        REPEAT 2:
            A = A + 3
            A = A + 5
            A = A + 2
        A = A + 6
    A = A + 1
A = A + 2
A = A + 4
A = A + 9
REPEAT 1:
    A = A + 8
REPEAT 8:
    REPEAT 4:
        REPEAT 8:
            A = A + 4
        REPEAT 3:
            A = A + 1
            A = A + 8
        REPEAT 7:
            A = A + 8
        REPEAT 7:
            A = A + 7
        A = A + 7
        REPEAT 7:
            A = A + 6
        REPEAT 5:
            A = A + 9
        A = A + 3
        REPEAT 4:
            A = A + 5
        A = A + 5
    A = A + 4
    REPEAT 9:
        REPEAT 3:
            A = A + 4
            A = A + 3
            A = A + 6
        REPEAT 1:
            A = A + 3
            A = A + 3
            A = A + 6
        REPEAT 6:
            A = A + 7
            A = A + 7
            A = A + 5
            A = A + 5
            A = A + 1
            A = A + 2
        A = A + 6
        A = A + 6
    REPEAT 9:
        A = A + 6
    REPEAT 1:
        REPEAT 2:
            A = A + 4
            A = A + 7
        REPEAT 3:
            A = A + 6
        REPEAT 5:
            A = A + 3
        A = A + 6
        REPEAT 9:
            A = A + 3
        A = A + 6
    REPEAT 5:
        A = A + 8
        A = A + 8
        REPEAT 3:
            A = A + 7
            A = A + 9
            A = A + 8
            A = A + 3
        A = A + 3
    A = A + 9
REPEAT 6:
    A = A + 9
A = A + 1
REPEAT 4:
    REPEAT 1:
        A = A + 7
    REPEAT 9:
        A = A + 2
        A = A + 9
    A = A + 1
A = A + 2
A = A + 8
A = A + 7
A = A + 9
A = A + 6
REPEAT 4:
    REPEAT 2:
        A = A + 3
    REPEAT 3:
        A = A + 4
    A = A + 4
REPEAT 6:
    A = A + 6
A = A + 1
A = A + 5
A = A + 8
REPEAT 2:
    A = A + 6
    REPEAT 1:
        REPEAT 2:
            A = A + 2
        REPEAT 3:
            A = A + 1
        REPEAT 1:
            A = A + 8
            A = A + 7
            A = A + 4
            A = A + 2
            A = A + 8
        A = A + 4
    REPEAT 5:
        REPEAT 6:
            A = A + 8
        REPEAT 9:
            A = A + 5
        A = A + 5
    REPEAT 5:
        A = A + 5
    REPEAT 3:
        REPEAT 5:
            A = A + 4
        REPEAT 4:
            A = A + 6
            A = A + 3
        REPEAT 7:
            A = A + 3
            A = A + 3
            A = A + 1
            A = A + 7
            A = A + 7
            A = A + 6
            A = A + 5
            A = A + 5
        A = A + 6
    REPEAT 1:
        A = A + 9
    A = A + 3
    REPEAT 1:
        REPEAT 1:
            A = A + 1
        REPEAT 8:
            A = A + 5
        REPEAT 8:
            A = A + 6
        REPEAT 4:
            A = A + 9
        A = A + 4
    REPEAT 2:
        A = A + 3
        A = A + 7
        REPEAT 5:
            A = A + 7
            A = A + 5
            A = A + 8
        A = A + 7
        A = A + 8
    A = A + 5
    REPEAT 2:
        A = A + 5
    A = A + 7
    A = A + 8
A = A + 5
A = A + 9
REPEAT 2:
    REPEAT 6:
        A = A + 9
        A = A + 1
        A = A + 8
        A = A + 7
        A = A + 1
        A = A + 5
    REPEAT 3:
        A = A + 3
        A = A + 9
        A = A + 7
    REPEAT 3:
        A = A + 9
    A = A + 1
    REPEAT 6:
        A = A + 1
    REPEAT 9:
        REPEAT 7:
            A = A + 3
        REPEAT 5:
            A = A + 5
            A = A + 8
            A = A + 8
            A = A + 1
            A = A + 2
        REPEAT 4:
            A = A + 6
        REPEAT 3:
            A = A + 3
        A = A + 7
    REPEAT 8:
        REPEAT 1:
            A = A + 7
        A = A + 8
        A = A + 3
    A = A + 1
A = A + 2
A = A + 4
A = A + 7
REPEAT 1:
    REPEAT 1:
        REPEAT 1:
            A = A + 4
            A = A + 6
        REPEAT 1:
            A = A + 3
            A = A + 9
            A = A + 6
        REPEAT 9:
            A = A + 1
            A = A + 6
        REPEAT 5:
            A = A + 3
            A = A + 9
        A = A + 5
        A = A + 5
    A = A + 7
    A = A + 2
    REPEAT 2:
        A = A + 7
    A = A + 7
    REPEAT 7:
        REPEAT 4:
            A = A + 6
        A = A + 8
        REPEAT 6:
            A = A + 6
        REPEAT 2:
            A = A + 1
        A = A + 7
        A = A + 6
    A = A + 7
    REPEAT 4:
        REPEAT 7:
            A = A + 1
        REPEAT 2:
            A = A + 2
            A = A + 5
        A = A + 8
    A = A + 2
A = A + 1
A = A + 4
REPEAT 8:
    A = A + 5
A = A + 6
REPEAT 7:
    REPEAT 6:
        REPEAT 9:
            A = A + 7
            A = A + 8
        REPEAT 4:
            A = A + 6
            A = A + 4
            A = A + 3
            A = A + 6
        REPEAT 9:
            A = A + 3
        REPEAT 9:
            A = A + 2
        A = A + 7
    A = A + 5
    A = A + 2
REPEAT 7:
    REPEAT 8:
        REPEAT 6:
            A = A + 4
            A = A + 9
            A = A + 5
            A = A + 3
        A = A + 9
    REPEAT 4:
        REPEAT 1:
            A = A + 6
            A = A + 8
        REPEAT 1:
            A = A + 6
        A = A + 4
        A = A + 6
    REPEAT 3:
        A = A + 7
        REPEAT 3:
            A = A + 4
            A = A + 4
            A = A + 2
        A = A + 3
        A = A + 7
    REPEAT 5:
        A = A + 6
        A = A + 5
    REPEAT 1:
        REPEAT 8:
            A = A + 5
        REPEAT 3:
            A = A + 6
        REPEAT 9:
            A = A + 4
        A = A + 3
    REPEAT 6:
        REPEAT 2:
            A = A + 1
        A = A + 5
    A = A + 2
A = A + 2
A = A + 7
REPEAT 4:
    A = A + 7
A = A + 9
A = A + 2
REPEAT 8:
    A = A + 9
    REPEAT 9:
        REPEAT 2:
            A = A + 3
            A = A + 2
            A = A + 1
            A = A + 5
        REPEAT 9:
            A = A + 1
            A = A + 3
        A = A + 9
        REPEAT 7:
            A = A + 2
        REPEAT 5:
            A = A + 9
            A = A + 3
        REPEAT 2:
            A = A + 4
        REPEAT 8:
            A = A + 9
        REPEAT 5:
            A = A + 5
            A = A + 4
        A = A + 2
    A = A + 4
    REPEAT 6:
        A = A + 2
        REPEAT 5:
            A = A + 7
            A = A + 7
            A = A + 8
            A = A + 3
        REPEAT 8:
            A = A + 2
            A = A + 5
        REPEAT 1:
            A = A + 8
            A = A + 5
            A = A + 1
            A = A + 1
        A = A + 5
        REPEAT 2:
            A = A + 6
        REPEAT 6:
            A = A + 9
            A = A + 2
        A = A + 5
        REPEAT 4:
            A = A + 7
        A = A + 1
        REPEAT 6:
            A = A + 8
        A = A + 4
    REPEAT 3:
        REPEAT 2:
            A = A + 1
            A = A + 5
        REPEAT 2:
            A = A + 7
        REPEAT 9:
            A = A + 6
            A = A + 8
            A = A + 9
        A = A + 5
    REPEAT 9:
        REPEAT 3:
            A = A + 7
            A = A + 7
        A = A + 9
        A = A + 7
        REPEAT 5:
            A = A + 7
            A = A + 2
        A = A + 1
    A = A + 8
    A = A + 3
    A = A + 5
A = A + 1
REPEAT 8:
    A = A + 4
A = A + 2
A = A + 2
A = A + 8
REPEAT 4:
    REPEAT 4:
        A = A + 8
        REPEAT 7:
            A = A + 5
            A = A + 2
        REPEAT 2:
            A = A + 6
        REPEAT 4:
            A = A + 8
            A = A + 6
        A = A + 1
    A = A + 3
A = A + 2
A = A + 7
A = A + 4
REPEAT 8:
    A = A + 2
    A = A + 4
REPEAT 5:
    REPEAT 3:
        REPEAT 6:
            A = A + 8
            A = A + 1
        A = A + 6
    A = A + 5
    A = A + 9
REPEAT 8:
    A = A + 7
REPEAT 6:
    A = A + 4
A = A + 5
REPEAT 3:
    A = A + 1
    REPEAT 1:
        REPEAT 5:
            A = A + 6
        A = A + 2
    REPEAT 9:
        REPEAT 5:
            A = A + 9
            A = A + 3
        REPEAT 9:
            A = A + 9
        A = A + 8
    REPEAT 8:
        REPEAT 5:
            A = A + 9
            A = A + 4
        REPEAT 9:
            A = A + 3
        A = A + 4
    A = A + 5
REPEAT 9:
    REPEAT 7:
        A = A + 5
    REPEAT 3:
        A = A + 7
    REPEAT 9:
        REPEAT 6:
            A = A + 4
        A = A + 6
    REPEAT 5:
        REPEAT 6:
            A = A + 5
            A = A + 3
        A = A + 3
    A = A + 3
    A = A + 5
    REPEAT 7:
        A = A + 5
        REPEAT 2:
            A = A + 5
            A = A + 6
        REPEAT 2:
            A = A + 2
        A = A + 5
    A = A + 3
A = A + 5
A = A + 5
REPEAT 4:
    A = A + 2
    A = A + 1
    REPEAT 9:
        A = A + 9
        A = A + 5
        A = A + 6
        A = A + 2
        A = A + 2
        A = A + 5
    REPEAT 9:
        A = A + 5
    A = A + 4
    REPEAT 4:
        REPEAT 4:
            A = A + 1
            A = A + 2
        REPEAT 6:
            A = A + 9
            A = A + 3
        REPEAT 2:
            A = A + 5
            A = A + 1
            A = A + 1
            A = A + 3
        A = A + 8
        REPEAT 7:
            A = A + 4
        REPEAT 6:
            A = A + 9
        REPEAT 5:
            A = A + 9
            A = A + 8
            A = A + 3
        A = A + 9
        A = A + 4
    A = A + 6
REPEAT 7:
    A = A + 9
REPEAT 9:
    A = A + 4
    A = A + 9
    A = A + 1
    A = A + 3
    REPEAT 5:
        REPEAT 1:
            A = A + 4
            A = A + 4
        REPEAT 8:
            A = A + 9
            A = A + 6
            A = A + 2
        REPEAT 3:
            A = A + 4
            A = A + 4
        REPEAT 3:
            A = A + 5
            A = A + 2
            A = A + 8
            A = A + 3
            A = A + 6
            A = A + 4
            A = A + 9
            A = A + 1
        A = A + 9
        A = A + 5
        A = A + 3
        REPEAT 3:
            A = A + 2
            A = A + 5
            A = A + 8
            A = A + 2
        A = A + 5
    REPEAT 8:
        REPEAT 2:
            A = A + 6
        A = A + 7
    A = A + 6
    A = A + 9
    A = A + 2
REPEAT 2:
    A = A + 3
    REPEAT 8:
        A = A + 7
        A = A + 2
        A = A + 1
        A = A + 4
        A = A + 1
        A = A + 5
    A = A + 2
    A = A + 1
    REPEAT 1:
        A = A + 1
    REPEAT 6:
        A = A + 4
        A = A + 3
    A = A + 3
    REPEAT 5:
        A = A + 3
    REPEAT 6:
        REPEAT 1:
            A = A + 5
            A = A + 7
            A = A + 7
            A = A + 7
        REPEAT 5:
            A = A + 9
        A = A + 7
        REPEAT 5:
            A = A + 9
            A = A + 1
            A = A + 9
        A = A + 8
        REPEAT 1:
            A = A + 2
        REPEAT 5:
            A = A + 8
        REPEAT 3:
            A = A + 2
            A = A + 9
        A = A + 6
        A = A + 3
    REPEAT 5:
        REPEAT 6:
            A = A + 5
            A = A + 5
        REPEAT 4:
            A = A + 5
        A = A + 4
        REPEAT 8:
            A = A + 9
            A = A + 1
        REPEAT 8:
            A = A + 8
            A = A + 1
        A = A + 4
        REPEAT 6:
            A = A + 6
        REPEAT 2:
            A = A + 3
            A = A + 9
            A = A + 6
            A = A + 9
        REPEAT 1:
            A = A + 4
        REPEAT 3:
            A = A + 3
            A = A + 4
            A = A + 2
            A = A + 8
        REPEAT 2:
            A = A + 4
        A = A + 1
        REPEAT 9:
            A = A + 2
        A = A + 9
    A = A + 7
REPEAT 7:
    REPEAT 7:
        REPEAT 5:
            A = A + 7
        REPEAT 5:
            A = A + 1
        A = A + 1
    REPEAT 5:
        A = A + 6
        REPEAT 1:
            A = A + 4
        REPEAT 9:
            A = A + 4
        A = A + 1
    REPEAT 6:
        A = A + 8
        A = A + 5
        REPEAT 1:
            A = A + 4
        REPEAT 5:
            A = A + 8
            A = A + 7
        A = A + 2
    REPEAT 3:
        A = A + 3
    REPEAT 8:
        REPEAT 8:
            A = A + 4
        A = A + 7
        REPEAT 5:
            A = A + 1
        REPEAT 8:
            A = A + 7
            A = A + 8
            A = A + 4
        A = A + 7
        A = A + 6
    A = A + 9
    A = A + 5
REPEAT 3:
    A = A + 5
    REPEAT 9:
        A = A + 1
    A = A + 7
REPEAT 1:
    A = A + 8
A = A + 4
REPEAT 8:
    REPEAT 7:
        A = A + 2
        REPEAT 4:
            A = A + 6
        A = A + 6
    REPEAT 1:
        A = A + 7
    A = A + 1
REPEAT 9:
    REPEAT 5:
        A = A + 6
        A = A + 5
        REPEAT 7:
            A = A + 3
            A = A + 6
        A = A + 8
    REPEAT 2:
        A = A + 7
    A = A + 1
    A = A + 9
    REPEAT 3:
        REPEAT 3:
            A = A + 5
"""
a = re.sub("        REPEAT ","        for k in range(",a)
a = re.sub(":","):",a)
a = re.sub("    REPEAT ","    for j in range(",a)
a = re.sub("REPEAT ","for i in range(",a)

print(a)

转换后的Python程序为:

A = 0
for i in range(2):
    A = A + 4
    for j in range(5):
        for k in range(6):
            A = A + 5
        A = A + 7
    for j in range(6):
        A = A + 7
        for k in range(4):
            A = A + 2
            A = A + 7
        A = A + 2
    for j in range(7):
        for k in range(4):
            A = A + 8
            A = A + 7
            A = A + 4
            A = A + 5
        A = A + 8
    for j in range(8):
        A = A + 5
        for k in range(1):
            A = A + 2
        for k in range(7):
            A = A + 5
        A = A + 5
    for j in range(2):
        for k in range(3):
            A = A + 1
        A = A + 1
    for j in range(5):
        A = A + 1
    for j in range(9):
        for k in range(6):
            A = A + 5
            A = A + 1
        for k in range(6):
            A = A + 2
            A = A + 8
            A = A + 3
        for k in range(2):
            A = A + 5
        for k in range(3):
            A = A + 9
        for k in range(1):
            A = A + 4
        for k in range(2):
            A = A + 9
        for k in range(1):
            A = A + 6
            A = A + 6
            A = A + 4
        for k in range(3):
            A = A + 7
        A = A + 1
        for k in range(2):
            A = A + 3
        for k in range(5):
            A = A + 2
            A = A + 5
            A = A + 2
        A = A + 4
    A = A + 3
for i in range(4):
    A = A + 4
    A = A + 3
    A = A + 7
    for j in range(5):
        for k in range(4):
            A = A + 5
            A = A + 7
        for k in range(5):
            A = A + 3
        for k in range(3):
            A = A + 3
            A = A + 1
        A = A + 8
        A = A + 2
        for k in range(9):
            A = A + 5
        for k in range(1):
            A = A + 5
        A = A + 2
    A = A + 8
A = A + 6
for i in range(3):
    for j in range(4):
        A = A + 9
        for k in range(5):
            A = A + 2
        A = A + 1
    for j in range(9):
        A = A + 9
        A = A + 2
        for k in range(1):
            A = A + 6
            A = A + 8
        for k in range(2):
            A = A + 9
            A = A + 4
        A = A + 7
    for j in range(2):
        for k in range(7):
            A = A + 3
            A = A + 5
        for k in range(3):
            A = A + 5
            A = A + 3
            A = A + 6
            A = A + 4
        for k in range(9):
            A = A + 2
            A = A + 8
            A = A + 2
        A = A + 3
    for j in range(2):
        for k in range(8):
            A = A + 5
            A = A + 1
        A = A + 6
        A = A + 1
    A = A + 2
    for j in range(6):
        for k in range(1):
            A = A + 3
        for k in range(1):
            A = A + 2
        for k in range(4):
            A = A + 7
            A = A + 1
        A = A + 8
        for k in range(6):
            A = A + 5
        for k in range(6):
            A = A + 3
        for k in range(2):
            A = A + 2
            A = A + 9
        A = A + 7
    for j in range(9):
        A = A + 8
        for k in range(9):
            A = A + 8
            A = A + 9
            A = A + 3
        A = A + 2
        for k in range(6):
            A = A + 3
        for k in range(9):
            A = A + 1
        A = A + 9
        A = A + 5
        for k in range(2):
            A = A + 4
            A = A + 9
        A = A + 8
        for k in range(5):
            A = A + 6
            A = A + 9
        A = A + 1
    for j in range(1):
        A = A + 4
    A = A + 2
    for j in range(9):
        for k in range(3):
            A = A + 4
        for k in range(7):
            A = A + 8
            A = A + 3
        for k in range(5):
            A = A + 9
        for k in range(8):
            A = A + 9
            A = A + 8
        for k in range(4):
            A = A + 7
        A = A + 7
    A = A + 3
A = A + 5
for i in range(6):
    A = A + 7
for i in range(7):
    A = A + 2
    A = A + 2
A = A + 1
for i in range(8):
    for j in range(1):
        for k in range(4):
            A = A + 6
            A = A + 6
            A = A + 2
        for k in range(5):
            A = A + 4
            A = A + 8
            A = A + 4
        for k in range(1):
            A = A + 5
        for k in range(7):
            A = A + 8
        for k in range(6):
            A = A + 4
        A = A + 4
        A = A + 8
        for k in range(4):
            A = A + 2
        for k in range(2):
            A = A + 4
        for k in range(2):
            A = A + 3
        for k in range(1):
            A = A + 2
        A = A + 8
        for k in range(2):
            A = A + 7
        for k in range(8):
            A = A + 6
            A = A + 1
        A = A + 7
    for j in range(8):
        A = A + 2
    for j in range(8):
        for k in range(6):
            A = A + 1
            A = A + 6
        for k in range(2):
            A = A + 4
            A = A + 1
        A = A + 7
    A = A + 4
for i in range(4):
    for j in range(9):
        A = A + 2
    for j in range(1):
        A = A + 2
    A = A + 5
for i in range(8):
    for j in range(6):
        A = A + 3
    for j in range(4):
        A = A + 1
        A = A + 6
        A = A + 1
    for j in range(7):
        A = A + 7
        for k in range(7):
            A = A + 3
            A = A + 9
            A = A + 1
            A = A + 9
        for k in range(3):
            A = A + 5
        A = A + 5
        A = A + 6
        A = A + 2
    for j in range(1):
        A = A + 4
    for j in range(2):
        A = A + 7
    for j in range(1):
        A = A + 7
        for k in range(4):
            A = A + 7
        A = A + 2
        for k in range(5):
            A = A + 9
            A = A + 1
            A = A + 9
            A = A + 5
            A = A + 9
        for k in range(5):
            A = A + 5
        for k in range(1):
            A = A + 6
        for k in range(2):
            A = A + 3
            A = A + 2
            A = A + 6
            A = A + 8
            A = A + 8
            A = A + 7
        A = A + 5
    A = A + 5
for i in range(2):
    A = A + 1
    A = A + 7
A = A + 3
for i in range(2):
    A = A + 7
A = A + 1
A = A + 4
for i in range(1):
    for j in range(7):
        for k in range(2):
            A = A + 3
            A = A + 5
            A = A + 2
        A = A + 6
    A = A + 1
A = A + 2
A = A + 4
A = A + 9
for i in range(1):
    A = A + 8
for i in range(8):
    for j in range(4):
        for k in range(8):
            A = A + 4
        for k in range(3):
            A = A + 1
            A = A + 8
        for k in range(7):
            A = A + 8
        for k in range(7):
            A = A + 7
        A = A + 7
        for k in range(7):
            A = A + 6
        for k in range(5):
            A = A + 9
        A = A + 3
        for k in range(4):
            A = A + 5
        A = A + 5
    A = A + 4
    for j in range(9):
        for k in range(3):
            A = A + 4
            A = A + 3
            A = A + 6
        for k in range(1):
            A = A + 3
            A = A + 3
            A = A + 6
        for k in range(6):
            A = A + 7
            A = A + 7
            A = A + 5
            A = A + 5
            A = A + 1
            A = A + 2
        A = A + 6
        A = A + 6
    for j in range(9):
        A = A + 6
    for j in range(1):
        for k in range(2):
            A = A + 4
            A = A + 7
        for k in range(3):
            A = A + 6
        for k in range(5):
            A = A + 3
        A = A + 6
        for k in range(9):
            A = A + 3
        A = A + 6
    for j in range(5):
        A = A + 8
        A = A + 8
        for k in range(3):
            A = A + 7
            A = A + 9
            A = A + 8
            A = A + 3
        A = A + 3
    A = A + 9
for i in range(6):
    A = A + 9
A = A + 1
for i in range(4):
    for j in range(1):
        A = A + 7
    for j in range(9):
        A = A + 2
        A = A + 9
    A = A + 1
A = A + 2
A = A + 8
A = A + 7
A = A + 9
A = A + 6
for i in range(4):
    for j in range(2):
        A = A + 3
    for j in range(3):
        A = A + 4
    A = A + 4
for i in range(6):
    A = A + 6
A = A + 1
A = A + 5
A = A + 8
for i in range(2):
    A = A + 6
    for j in range(1):
        for k in range(2):
            A = A + 2
        for k in range(3):
            A = A + 1
        for k in range(1):
            A = A + 8
            A = A + 7
            A = A + 4
            A = A + 2
            A = A + 8
        A = A + 4
    for j in range(5):
        for k in range(6):
            A = A + 8
        for k in range(9):
            A = A + 5
        A = A + 5
    for j in range(5):
        A = A + 5
    for j in range(3):
        for k in range(5):
            A = A + 4
        for k in range(4):
            A = A + 6
            A = A + 3
        for k in range(7):
            A = A + 3
            A = A + 3
            A = A + 1
            A = A + 7
            A = A + 7
            A = A + 6
            A = A + 5
            A = A + 5
        A = A + 6
    for j in range(1):
        A = A + 9
    A = A + 3
    for j in range(1):
        for k in range(1):
            A = A + 1
        for k in range(8):
            A = A + 5
        for k in range(8):
            A = A + 6
        for k in range(4):
            A = A + 9
        A = A + 4
    for j in range(2):
        A = A + 3
        A = A + 7
        for k in range(5):
            A = A + 7
            A = A + 5
            A = A + 8
        A = A + 7
        A = A + 8
    A = A + 5
    for j in range(2):
        A = A + 5
    A = A + 7
    A = A + 8
A = A + 5
A = A + 9
for i in range(2):
    for j in range(6):
        A = A + 9
        A = A + 1
        A = A + 8
        A = A + 7
        A = A + 1
        A = A + 5
    for j in range(3):
        A = A + 3
        A = A + 9
        A = A + 7
    for j in range(3):
        A = A + 9
    A = A + 1
    for j in range(6):
        A = A + 1
    for j in range(9):
        for k in range(7):
            A = A + 3
        for k in range(5):
            A = A + 5
            A = A + 8
            A = A + 8
            A = A + 1
            A = A + 2
        for k in range(4):
            A = A + 6
        for k in range(3):
            A = A + 3
        A = A + 7
    for j in range(8):
        for k in range(1):
            A = A + 7
        A = A + 8
        A = A + 3
    A = A + 1
A = A + 2
A = A + 4
A = A + 7
for i in range(1):
    for j in range(1):
        for k in range(1):
            A = A + 4
            A = A + 6
        for k in range(1):
            A = A + 3
            A = A + 9
            A = A + 6
        for k in range(9):
            A = A + 1
            A = A + 6
        for k in range(5):
            A = A + 3
            A = A + 9
        A = A + 5
        A = A + 5
    A = A + 7
    A = A + 2
    for j in range(2):
        A = A + 7
    A = A + 7
    for j in range(7):
        for k in range(4):
            A = A + 6
        A = A + 8
        for k in range(6):
            A = A + 6
        for k in range(2):
            A = A + 1
        A = A + 7
        A = A + 6
    A = A + 7
    for j in range(4):
        for k in range(7):
            A = A + 1
        for k in range(2):
            A = A + 2
            A = A + 5
        A = A + 8
    A = A + 2
A = A + 1
A = A + 4
for i in range(8):
    A = A + 5
A = A + 6
for i in range(7):
    for j in range(6):
        for k in range(9):
            A = A + 7
            A = A + 8
        for k in range(4):
            A = A + 6
            A = A + 4
            A = A + 3
            A = A + 6
        for k in range(9):
            A = A + 3
        for k in range(9):
            A = A + 2
        A = A + 7
    A = A + 5
    A = A + 2
for i in range(7):
    for j in range(8):
        for k in range(6):
            A = A + 4
            A = A + 9
            A = A + 5
            A = A + 3
        A = A + 9
    for j in range(4):
        for k in range(1):
            A = A + 6
            A = A + 8
        for k in range(1):
            A = A + 6
        A = A + 4
        A = A + 6
    for j in range(3):
        A = A + 7
        for k in range(3):
            A = A + 4
            A = A + 4
            A = A + 2
        A = A + 3
        A = A + 7
    for j in range(5):
        A = A + 6
        A = A + 5
    for j in range(1):
        for k in range(8):
            A = A + 5
        for k in range(3):
            A = A + 6
        for k in range(9):
            A = A + 4
        A = A + 3
    for j in range(6):
        for k in range(2):
            A = A + 1
        A = A + 5
    A = A + 2
A = A + 2
A = A + 7
for i in range(4):
    A = A + 7
A = A + 9
A = A + 2
for i in range(8):
    A = A + 9
    for j in range(9):
        for k in range(2):
            A = A + 3
            A = A + 2
            A = A + 1
            A = A + 5
        for k in range(9):
            A = A + 1
            A = A + 3
        A = A + 9
        for k in range(7):
            A = A + 2
        for k in range(5):
            A = A + 9
            A = A + 3
        for k in range(2):
            A = A + 4
        for k in range(8):
            A = A + 9
        for k in range(5):
            A = A + 5
            A = A + 4
        A = A + 2
    A = A + 4
    for j in range(6):
        A = A + 2
        for k in range(5):
            A = A + 7
            A = A + 7
            A = A + 8
            A = A + 3
        for k in range(8):
            A = A + 2
            A = A + 5
        for k in range(1):
            A = A + 8
            A = A + 5
            A = A + 1
            A = A + 1
        A = A + 5
        for k in range(2):
            A = A + 6
        for k in range(6):
            A = A + 9
            A = A + 2
        A = A + 5
        for k in range(4):
            A = A + 7
        A = A + 1
        for k in range(6):
            A = A + 8
        A = A + 4
    for j in range(3):
        for k in range(2):
            A = A + 1
            A = A + 5
        for k in range(2):
            A = A + 7
        for k in range(9):
            A = A + 6
            A = A + 8
            A = A + 9
        A = A + 5
    for j in range(9):
        for k in range(3):
            A = A + 7
            A = A + 7
        A = A + 9
        A = A + 7
        for k in range(5):
            A = A + 7
            A = A + 2
        A = A + 1
    A = A + 8
    A = A + 3
    A = A + 5
A = A + 1
for i in range(8):
    A = A + 4
A = A + 2
A = A + 2
A = A + 8
for i in range(4):
    for j in range(4):
        A = A + 8
        for k in range(7):
            A = A + 5
            A = A + 2
        for k in range(2):
            A = A + 6
        for k in range(4):
            A = A + 8
            A = A + 6
        A = A + 1
    A = A + 3
A = A + 2
A = A + 7
A = A + 4
for i in range(8):
    A = A + 2
    A = A + 4
for i in range(5):
    for j in range(3):
        for k in range(6):
            A = A + 8
            A = A + 1
        A = A + 6
    A = A + 5
    A = A + 9
for i in range(8):
    A = A + 7
for i in range(6):
    A = A + 4
A = A + 5
for i in range(3):
    A = A + 1
    for j in range(1):
        for k in range(5):
            A = A + 6
        A = A + 2
    for j in range(9):
        for k in range(5):
            A = A + 9
            A = A + 3
        for k in range(9):
            A = A + 9
        A = A + 8
    for j in range(8):
        for k in range(5):
            A = A + 9
            A = A + 4
        for k in range(9):
            A = A + 3
        A = A + 4
    A = A + 5
for i in range(9):
    for j in range(7):
        A = A + 5
    for j in range(3):
        A = A + 7
    for j in range(9):
        for k in range(6):
            A = A + 4
        A = A + 6
    for j in range(5):
        for k in range(6):
            A = A + 5
            A = A + 3
        A = A + 3
    A = A + 3
    A = A + 5
    for j in range(7):
        A = A + 5
        for k in range(2):
            A = A + 5
            A = A + 6
        for k in range(2):
            A = A + 2
        A = A + 5
    A = A + 3
A = A + 5
A = A + 5
for i in range(4):
    A = A + 2
    A = A + 1
    for j in range(9):
        A = A + 9
        A = A + 5
        A = A + 6
        A = A + 2
        A = A + 2
        A = A + 5
    for j in range(9):
        A = A + 5
    A = A + 4
    for j in range(4):
        for k in range(4):
            A = A + 1
            A = A + 2
        for k in range(6):
            A = A + 9
            A = A + 3
        for k in range(2):
            A = A + 5
            A = A + 1
            A = A + 1
            A = A + 3
        A = A + 8
        for k in range(7):
            A = A + 4
        for k in range(6):
            A = A + 9
        for k in range(5):
            A = A + 9
            A = A + 8
            A = A + 3
        A = A + 9
        A = A + 4
    A = A + 6
for i in range(7):
    A = A + 9
for i in range(9):
    A = A + 4
    A = A + 9
    A = A + 1
    A = A + 3
    for j in range(5):
        for k in range(1):
            A = A + 4
            A = A + 4
        for k in range(8):
            A = A + 9
            A = A + 6
            A = A + 2
        for k in range(3):
            A = A + 4
            A = A + 4
        for k in range(3):
            A = A + 5
            A = A + 2
            A = A + 8
            A = A + 3
            A = A + 6
            A = A + 4
            A = A + 9
            A = A + 1
        A = A + 9
        A = A + 5
        A = A + 3
        for k in range(3):
            A = A + 2
            A = A + 5
            A = A + 8
            A = A + 2
        A = A + 5
    for j in range(8):
        for k in range(2):
            A = A + 6
        A = A + 7
    A = A + 6
    A = A + 9
    A = A + 2
for i in range(2):
    A = A + 3
    for j in range(8):
        A = A + 7
        A = A + 2
        A = A + 1
        A = A + 4
        A = A + 1
        A = A + 5
    A = A + 2
    A = A + 1
    for j in range(1):
        A = A + 1
    for j in range(6):
        A = A + 4
        A = A + 3
    A = A + 3
    for j in range(5):
        A = A + 3
    for j in range(6):
        for k in range(1):
            A = A + 5
            A = A + 7
            A = A + 7
            A = A + 7
        for k in range(5):
            A = A + 9
        A = A + 7
        for k in range(5):
            A = A + 9
            A = A + 1
            A = A + 9
        A = A + 8
        for k in range(1):
            A = A + 2
        for k in range(5):
            A = A + 8
        for k in range(3):
            A = A + 2
            A = A + 9
        A = A + 6
        A = A + 3
    for j in range(5):
        for k in range(6):
            A = A + 5
            A = A + 5
        for k in range(4):
            A = A + 5
        A = A + 4
        for k in range(8):
            A = A + 9
            A = A + 1
        for k in range(8):
            A = A + 8
            A = A + 1
        A = A + 4
        for k in range(6):
            A = A + 6
        for k in range(2):
            A = A + 3
            A = A + 9
            A = A + 6
            A = A + 9
        for k in range(1):
            A = A + 4
        for k in range(3):
            A = A + 3
            A = A + 4
            A = A + 2
            A = A + 8
        for k in range(2):
            A = A + 4
        A = A + 1
        for k in range(9):
            A = A + 2
        A = A + 9
    A = A + 7
for i in range(7):
    for j in range(7):
        for k in range(5):
            A = A + 7
        for k in range(5):
            A = A + 1
        A = A + 1
    for j in range(5):
        A = A + 6
        for k in range(1):
            A = A + 4
        for k in range(9):
            A = A + 4
        A = A + 1
    for j in range(6):
        A = A + 8
        A = A + 5
        for k in range(1):
            A = A + 4
        for k in range(5):
            A = A + 8
            A = A + 7
        A = A + 2
    for j in range(3):
        A = A + 3
    for j in range(8):
        for k in range(8):
            A = A + 4
        A = A + 7
        for k in range(5):
            A = A + 1
        for k in range(8):
            A = A + 7
            A = A + 8
            A = A + 4
        A = A + 7
        A = A + 6
    A = A + 9
    A = A + 5
for i in range(3):
    A = A + 5
    for j in range(9):
        A = A + 1
    A = A + 7
for i in range(1):
    A = A + 8
A = A + 4
for i in range(8):
    for j in range(7):
        A = A + 2
        for k in range(4):
            A = A + 6
        A = A + 6
    for j in range(1):
        A = A + 7
    A = A + 1
for i in range(9):
    for j in range(5):
        A = A + 6
        A = A + 5
        for k in range(7):
            A = A + 3
            A = A + 6
        A = A + 8
    for j in range(2):
        A = A + 7
    A = A + 1
    A = A + 9
    for j in range(3):
        for k in range(3):
            A = A + 5
print(A)

执行后取得结果:241830

亓官劼 CSDN认证博客专家 Python 全栈 数据结构与算法
大家好,我是亓官劼(qíguānjié),在博客中分享数据结构与算法、Python全栈开发、Java后端开发、前端、OJ题解及各类报错信息解决方案等经验。一起加油,用知识改变命运,未来可期。
若有事项需联系博主,可通过Q1710269687进行联系,有空会回复。
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页
实付 99.00元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值