Processing math: 100%
1 Star 1 Fork 0

AYO/Algorithm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
GPL-3.0

蓝桥杯第十三届国赛PythonB组题解

【写在前边】

这次的题还是比较难的,只做出来7道,交上去6道,还有一半是暴力做的😂。只求国三了😭

开局两道填空题用了快两个小时,直接搞崩了心态。。淦!

本题解仅代表个人观点及思路,不代表标准答案。欢迎各位巨佬指导交流😊。

所有代码均存放于仓库:

Github:https://github.com/AYO-YO/Algorithm/tree/蓝桥杯_国赛

Gitee: https://gitee.com/ayo_yo/Algorithm/tree/蓝桥杯_国赛

试题A:斐波那契与7(5分)

【问题描述】 斐波那契数列的递推公式为:Fn=Fn1+Fn2,其中F1=F2=1。 请问,斐波那契数列的第1202202011200项(含)中,有多少项的个位是7

【答案提交】 这是一道结果填空的题,你只需要算出结果后提交即可。本题的结果为一个整数,在提交答案时只填写这个整数,填写多余的内容将无法得分。


【思路分析】

这道题又是一个超大数,斐波那契本来就是指数级增长,直接爆肯定是不行的。

经过两位大佬@m0_62944359的勘误,原方法是错误的。

同时由评论区大佬@秋雨洗鸡肉提醒,斐波那契数列的个位数60个为1轮,直接1000内的数+100内的数是不对的,会导致部分数错误计算。

因此在此写出大佬@秋雨洗鸡肉的正确方法:

  • 斐波那契数列个位数60个为一个循环

  • 60个数中共有8个7

    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0
    1 1 2 3 5 8 3 1 4 5 9 4 3 7 0 7 7 4 1 5 6 1 7 8 5 3 8 1 9 0 9 9 8 7 5 2 7 9 6 5 1 6 7 3 0 3 3 6 9 5 4 9 3 2 5 7 2 9 1 0
    
  • 因此,最终结果应为:

    202202011200/60
    Out[3]: 3370033520.0
    _*8
    Out[4]: 26960268160.0
    

【参考答案】

    26960268160

【完整代码】

A.py (Gitee.com)A.py (github.com)

试题B: 小蓝做实验(5分)

【问题描述】 小蓝很喜欢科研,他最近做了一个实验得到了一批实验数据,一共是两百万个正整数。如果按照预期,所有的实验数据 x 都应该满足 10⁷ ≤ x ≤ 10⁸。但是做实验都会有一些误差,会导致出现一些预期外的数据,这种误差数据 y 的范围是 10³ ≤ y ≤ 10¹² 。由于小蓝做实验很可靠,所以他所有的实验数据中 99.99% 以上都是符合预期的。小蓝的所有实验数据都在 primes.txt 中,现在他想统计这两百万个正整数中有多少个是质数,你能告诉他吗?

【答案提交】 这是一道结果填空的题,你只需要算出结果后提交即可。本题的结果为一个整数,在提交答案时只填写这个整数,填写多余的内容将无法得分。


【思路分析】

这个题有200w个数,直接暴力找肯定不行。我一开始走了弯路子,多线程,素数判断优化都用上了。最后才发现我想多了,比赛结束前1分钟才把数爆出来,也没时间写针对大数的素性测试了。。思路如下:

  1. 首先观察数据,均以1、3、5、7结尾。大于1000且结尾为5的数,肯定能被5整除,于是先利用编辑器正则替换所有以5结尾的数,此时剩下约150w多个数:

    \d+?5
    
    

使用埃氏筛选法,获得10^8以内的所有质数,这里注意,利用埃氏筛选法需要进行优化,不然也是跑的头大。我在之前博客里也写过直接判断质数的优化方法,除了2、3,所有质数均位于6n左右。因此可以直接将埃氏筛选法的步长拉到6,这样速度能进一步提升,然后影响埃氏筛选法速度的大头主要是2、3、5,需要进行多次循环才能筛掉后边的合数,因此预处理在生成列表时直接将2、3、5的倍数归0。理论上直接归零的质数倍数越多,生成素数就越快。

计数质数 Python 埃氏筛选法_AYO_YO的博客-CSDN博客

判断质数 Python Java C++_AYO_YO的博客-CSDN博客

def getprimes(n):
    ls = [i if i % 2 != 0 and i % 3 != 0 and i % 5 != 0 else 0 for i in range(n + 1)]
    ls[1], ls[2], ls[3], ls[5] = 0, 2, 3, 5
    for i in range(6, n + 1, 6):
        f = i - 1
        if f != 0:
            for j in range(2 * f, n + 1, f):
                ls[j] = 0
            continue
        f = i + 1
        if f != 0:
            for j in range(2 * f, n + 1, f):
                ls[j] = 0
    return filter(lambda x: x != 0, ls)
  1. 埃氏筛选法筛选108以内的质数大概需要2分钟左右,再大恐怕就难以承受了。于是先将108的质数统计出来,并把大于108的质数拎出来。得到结果108以内的质数有506733个。大数有约130个。

    506733
    [542693491967, 142787902577, 452440529173, 663634895869, 71242929179, 999870483413, 441673697183, 895134836909, 59008094959, 812048153483, 153230177243, 5986461211, 825268545161, 85386152959, 305669636917, 176618331487, 627185459239, 517233054923, 347714268719, 75380450897, 652349118967, 746710276723, 887316078643, 55623754253, 726602124691, 63723051253, 11944000489, 14326008041, 995344474081, 127374806651, 101228446879, 782792370337, 7616731547, 672817895497, 309261587441, 993510068537, 898280626321, 691250724803, 436362423451, 135244424501, 873959450791, 404517752423, 803431472291, 890481756773, 299729772337, 993254812121, 939705423281, 928689411767, 950796808643, 925182899009, 867933942403, 177084914339, 374154056921, 195931411013, 636268614181, 845966263637, 669349089677, 279219681547, 116772294307, 458677064359, 414099720659, 553029935971, 225122592047, 523383194647, 291752440213, 29190046721, 756126896941, 400963923179, 807339716593, 666619632839, 792597812483, 157223341237, 515677221383, 869902952023, 277744493561, 279840195947, 12066121523, 659914745389, 796743912131, 973038777059, 856703807231, 66169702601, 987064845247, 916671221021, 884623305749, 504935549881, 232438712231, 701919604183, 542037833447, 521942095081, 726449610001, 840499018589, 492469281101, 757165962919, 437417377471, 903288533789, 254110134101, 265121359891, 776841707227, 854559132599, 325401328397, 675731682791, 730947154187, 280786162939, 670729451441, 48996391291, 286681507897, 847973529401, 166381727761, 568868879153, 56085663143, 417414542761, 666771906149, 857635614683, 188918440631, 490214446741, 82741563491, 411523187461, 304024439243, 912661149107, 556591023551, 934801057481, 828742723319, 814141769183, 528476615281, 560425065263, 224638484077, 610321268093, 655599334577, 624348698849]
    

这些大数直接判断是否是质数也是相当恐怖的,于是判断特大数是否是质数,就要用另一个方法——费马素性测试。这个是我之前算法课期末作业研究过的一个算法,就是利用随机数随机对大数取余,如果能整除,就不是质数;加入了一个优化,加入了一个互质判断,大大提升了算法效率以及准确率。

for p in bigNum:
    K = 100 # 取随机数验证的次数,该次数越大,准确率越高。实测K=10就能得到准确结果了
    k = 0
    while k < K:  # 这里用while是后续判定随机完成率是否是100%
        b = int(random.random() * (p - 1) + 1)  # 生成一个1~p-1之间的随机整数
        factor = math.gcd(b, p)  # 计算b,p的最大公约数
        r = runFermatPower(b, p, p)  # 计算b^p mod p
        print(f"第{k + 1}次取随机数, 随机数b={b}, {b}{p}的最大公约数为{factor}, r=({b}^{p})mod p={r}", end=', ')
        if factor > 1:
            print(f"因b={b}与p={p}的最大公约数为{factor},不为互质数,故p={p}为合数")
            break
        elif r != b:
            print(f"因r={r},({b}^{p}) mod p ={r}!={b}, 故p={p}为合数")
            break
        else:
            print(f"故p={p}可能为素数")
            k += 1
    if k == K:
        print(f"经过{K}次循环验证, p={p}可能为素数, n为素数的概率为{(1 - 1 / (2 ** k)) * 100}%")
  1. 得到最终结果:

    506753
    

【完整代码】

比赛过程中的代码是分步骤的,一步步写,然后得到结果后再计算下一步,这个代码是优化过的完整版代码,直接运行就能得到最终结果。

B.py (Gitee.com) B.py (github.com)

试题C:取模(10分,10s,512MB)

【问题描述】

给定n,m,问是否存在两个不同的数x,y使得1x<ymnmodx=nmody

【输入格式】

输入包含多组独立的询问。

第一行包含一个整数 T 表示询问的组数。

接下来T行每行包含两个整数n,m,用一个空格分隔,表示一组询问。

【输出格式】

输出T行,每行依次对应一组询问的结果。如果存在,输出单词 Yes;如果不存在,输出单词 No

【样例输入】

3
1 2
5 2
999 99

【样例输出】

No 
No 
Yes

【评测用例规模与约定】

对于20%的评测用例,T100n,m1000

对于50%的评测用例,T10000n,m105

对于所有评测用例,1T1051n1092m109


【思路分析】

没啥巧妙的解法,直接暴力做,通关估计够呛。

【参考代码】

C.py (Gitee.com) C.py (github.com)

试题D:内存空间(10分,10s,512MB)

【问题描述】

小蓝最近总喜欢计算自己的代码中定义的变量占用了多少内存空间。为了简化问题,变量的类型只有以下三种:

int:整型变量,一个 int 型变量占用 4 Byte 的内存空间。

long:长整型变量,一个 long 型变量占用 8 Byte 的内存空间。

String:字符串变量,占用空间和字符串长度有关,设字符串长度为 L,则字符串占用 L Byte 的内存空间,如果字符串长度为 0 则占用 0 Byte 的内存空间。

定义变量的语句只有两种形式,第一种形式为:

type var1=value1,var2=value2…;

定义了若干个 type 类型变量 var1、var2、…,并且用 value1、value2…初始化,多个变量之间用, 分隔,语句以; 结尾,type 可能是 intlong String 。例如 int a=1,b=5,c=6; 占用空间为 12 Bytelong a=1,b=5;占用空间为 16 ByteString s1=””,s2=”hello”,s3=”world”; 占用空间为 10 Byte

第二种形式为:

type[] arr1=new type[size1],arr2=new type[size2]…;

定义了若干 type 类型的一维数组变量 arr1、arr2…,且数组的大小为 size1、size2…,多个变量之间用, 进行分隔,语句以; 结尾,type 只可能是 intlong 。例如 int[] a1=new int[10]; 占用的内存空间为 40 Bytelong[] a1=new long[10],a2=new long[10]; 占用的内存空间为160 Byte

已知小蓝有 T 条定义变量的语句,请你帮他统计下一共占用了多少内存空间。结果的表示方式为:aGBbMBcKBdB,其中 a、b、c、d 为统计的结果,GBMBKBB 为单位。优先用大的单位来表示,1GB=1024MB1MB=1024KB1KB=1024B,其中 B 表示 Byte。如果 a、b、c、d 中的某几个数字为0,那么不必输出这几个数字及其单位。题目保证一行中只有一句定义变量的语句,且每条语句都满足题干中描述的定义格式,所有的变量名都是合法的且均不重复。题目中的数据很规整,和上述给出的例子类似,除了类型后面有一个空格,以及定义数组时 new 后面的一个空格之外,不会出现多余的空格。

【输入格式】

输入的第一行包含一个整数T,表示有T句变量定义的语句。接下来T行,每行包含一句变量定义语句。

【输出格式】

输出一行包含一个字符串,表示所有语句所占用空间的总大小。

【样例输入 1】

1

long[] nums=new long[131072];

【样例输出 1】

1MB

【样例输入 2】

4
int a=0,b=0; long x=0,y=0;
String s1=”hello”,s2=”world”;
long[] arr1=new long[100000],arr2=new long[100000];

【样例输出 2】

1MB538KB546B

【样例说明】

样例 1,占用的空间为131072×8=1048576B,换算过后正好是 1MB,其它三个单位 GBKBB 前面的数字都为 0 ,所以不用输出。

样例 2,占用的空间为4×2+8×2+10+8×100000×2B,换算后是1MB538KB546B

【评测用例规模与约定】

对于所有评测用例,1T10,每条变量定义语句的长度不会超过1000。所有的变量名称长度不会超过10,且都由小写字母和数字组成。对于整型变量,初始化的值均是在其表示范围内的十进制整数,初始化的值不会是变量。对于 String 类型的变量,初始化的内容长度不会超过50,且内容仅包含小写字母和数字,初始化的值不会是变量。对于数组类型变量,数组的长度为一个整数,范围为:[0,230],数组的长度不会是变量。T条语句定义的变量所占的内存空间总大小不会超过 1 GB,且大于 0 B

【思路分析】

这个题乍一看还挺唬人的,占了足足3页,因为我前两道填空题占用了非常多的时间,已经开始慌了,到这题时一看题,心想凉了,这才第二道编程题就这么难了吗😂但仔细读了一下题目,发现并不难,跟着题目做就行,得益于Python操作字符串非常方便,所以能给这道题省下不少功夫。

思路如下:

  • 首先应该计算当前表达式占用了多少Byte,而且表达式中变量名、=、关键字new这些都属于无关变量,直接忽略即可

  • 获取输入的单行表达式后,使用input().split(maxsplit=1)获取输入并以第一个空格分隔,主要是用于判断最左侧的数据类型if '[]' in typ

  • 如果类型为数组,注意数组只有intlong

    • 获取数组的类型以后,直接正则匹配赋值式中的中括号(初始化数组的长度信息在这里,例如int[] arr = new int[3];取3)乘以对应变量长度相加即可
  • 如果类型为普通类型,则需要额外判断是不是String

    • 若为String:直接正则”.+?”匹配,注意题目样例里这是一个中文字符。匹配到所有值以后直接计算长度相加即可。
    • 若不为String:直接.count(',')计算,的长度,变量数量比,数量多1,然后乘以对应长度相加即可。
  • 把总长度按要求格式输出即可:

    def convertSize(byte):
        size = {'GB': 0, 'MB': 0, 'KB': 0, 'B': 0}
        if byte >= 1073741824:
            size['GB'] = byte // 1073741824
        byte %= 1073741824
        if byte >= 1048576:
            size['MB'] = byte // 1048576
        byte %= 1048576
        if byte >= 1024:
            size['KB'] = byte // 1024
        byte %= 1024
        size['B'] = byte
        return size
    
    
    def printSize(l):
        size = convertSize(l)
        ans = ''
        # 正常情况下直接遍历字典即可,但我不太确定考试环境的3.8中的字典是否有序。3.9以后肯定是有序的了
        if size['GB'] > 0:
            ans += f'{size["GB"]}GB'
        if size['MB'] > 0:
            ans += f'{size["MB"]}MB'
        if size['KB'] > 0:
            ans += f'{size["KB"]}KB'
        if size['B'] > 0:
            ans += f'{size["B"]}B'
        print(ans)
    

【参考代码】

D.py (Gitee.com) D.py (github.com)

试题E:近似GCD(15分,10s,512MB)

【问题描述】

小蓝有一个长度为n的数组A=(a1,a2,···,an),数组的子数组被定义为从原数组中选出连续的一个或多个元素组成的数组。数组的最大公约数指的是数组中所有元素的最大公约数。如果最多更改数组中的一个元素之后,数组的最大公约数为 g,那么称 g 为这个数组的近似 GCD。一个数组的近似 GCD 可能有多种取值。

具体的,判断 g 是否为一个子数组的近似 GCD 如下:

  1. 如果这个子数组的最大公约数就是 g,那么说明 g 是其近似 GCD。
  2. 在修改这个子数组中的一个元素之后(可以改成想要的任何值),子数组的最大公约数为 g,那么说明 g 是这个子数组的近似 GCD。

小蓝想知道,数组 A 有多少个长度大于等于 2 的子数组满足近似 GCD 的值为 g。

【输入格式】

输入的第一行包含两个整数 n, g,用一个空格分隔,分别表示数组 A 的长度和 g 的值。

第二行包含 n 个整数a1,a2,···,an,相邻两个整数之间用一个空格分隔。

【输出格式】

输出一行包含一个整数表示数组 A 有多少个长度大于等于 2 的子数组的近似 GCD 的值为 g 。

【样例输入】

5 3
1 3 6 4 10

【样例输出】

5

【样例说明】

满足条件的子数组有 5 个:

[1,3]:将 1 修改为 3 后,这个子数组的最大公约数为 3 ,满足条件。

[1,3,6]:将 1 修改为 3 后,这个子数组的最大公约数为 3 ,满足条件。

[3,6]:这个子数组的最大公约数就是 3 ,满足条件。

[3,6,4]:将 4 修改为 3 后,这个子数组的最大公约数为 3 ,满足条件。

[6,4]:将 4 修改为 3 后,这个子数组的最大公约数为 3,满足条件。

【评测用例规模与约定】

对于20%的评测用例,2n102

对于40%的评测用例,2n103

对于所有评测用例,2n1051g,ai109


【思路分析】

这道题虽然说是gcd,但和gcd其实没有什么关系。。。

主要是划分子数组,如果子数组中只有至多 1 个数不是 g 的因子。那么这个子数组就是满足条件的,因为可以任意修改,无需关注修改为什么值。

【参考代码】

E.py (Gitee.com) E.py (github.com)

试题I:owo(25分,10s,512MB)

【问题描述】

小蓝很喜欢 owo ,他现在有一些字符串,他想将这些字符串拼接起来,使得最终得到的字符串中出现尽可能多的 owo 。

在计算数量时,允许字符重叠,即 owowo 计算为 2 个,owowowo 计算为3 个。

请算出最优情况下得到的字符串中有多少个 owo。

【输入格式】

输入的第一行包含一个整数 n ,表示小蓝拥有的字符串的数量。接下来 n 行,每行包含一个由小写英文字母组成的字符串 si 。

【输出格式】

输出 n 行,每行包含一个整数,表示前 i 个字符串在最优拼接方案中可以得到的 owo 的数量。

【样例输入】

3
owo w ow

【样例输出】

1
1
2

【评测用例规模与约定】

对于10%的评测用例,n10

对于40%的评测用例,n300

对于60%的评测用例,n5000

对于所有评测用例,1n1061|si||si|106,其中|si|表示字符串si的长度。


【思路分析】

这个题虽然是25分的题,但用Python来做,不算难,,盲猜应该用动规,但时间不多了,来不及细推,我选择的是直接暴力做。暴力全排列,时间复杂度极其之高。虽然题目给了10s,,但估计还是过不去。

  • 首先是找到字符串里的owo,这个比较取巧的方法就是直接正则'owo'匹配,但是正则一个字符只能匹配一次,但是题目要求中o可以用两次,那么直接.replace('o','oo'),把每个o 扩充成两个,这样就可以正常进行正则匹配了。
  • 将每次输入都保存到数组中,然后使用itertools.permutations()生成全排列,再循环寻找最大owo最多的数组。

【完整代码】

I.py (Gitee.com) I.py (github.com)

试题J:替换字符(25分,10s,512MB)

【问题描述】

给定一个仅含小写英文字母的字符串 s,每次操作选择一个区间[li,ri]将 s的该区间中的所有字母xi全部替换成字母yi,问所有操作做完后,得到的字符串是什么。

【输入格式】

输入的第一行包含一个字符串 s 。第二行包含一个整数 m 。

接下来 m 行,每行包含 4 个参数li,ri,xi,yi,相邻两个参数之间用一个空格分隔,其中li,ri为整数,xi,yi为小写字母。

【输出格式】

输出一行包含一个字符串表示答案。

【样例输入】

abcaaea 4
1 7 c e
3 3 e b
3 6 b e
1 4 a c

【样例输出】

cbecaea

【评测用例规模与约定】

对于40%的评测用例,|s|,m5000

对于所有评测用例,1|s|,m1051liri|s|xiyi,其中 |s| 表示字符串 s 的长度。


【思路分析】

这个题甚至比之前的更简单,觉得需要优化吧,一看时间给了10s😂。直接跟着题目淦就行了。

【完整代码】

J.py (Gitee.com) J.py (github.com)

———分割线———

做出来的到这儿就结束了,剩下的三道题没做出来,恳请赐教哇。

试题F:交通信号(15分,10s,512MB)

【问题描述】 LQ 市的交通系统可以看成由 n 个结点和 m 条有向边组成的有向图。在每条边上有一个信号灯,会不断按绿黄红黄绿黄红黄... 的顺序循环 (初始时刚好变到绿灯) 。当信号灯为绿灯时允许正向通行,红灯时允许反向通行,黄灯时不允许通行。每条边上的信号灯的三种颜色的持续时长都互相独立,其中黄灯的持续时长等同于走完路径的耗时。当走到一条边上时,需要观察边上的信号灯,如果允许通行则可以通过此边,在通行过程中不再受信号灯的影响;否则需要等待,直到允许通行。

请问从结点 s 到结点 t 所需的最短时间是多少,如果 s 无法到达 t 则输出−1。

【输入格式】

输入的第一行包含四个整数n,m,s,t,相邻两个整数之间用一个空格分隔。接下来 m 行,每行包含五个整数ui,vi,gi,ri,di ,相邻两个整数之间用一个空格分隔,分别表示一条边的起点,终点,绿灯、红灯的持续时长和距离(黄灯的持续时长)。

【输出格式】

输出一行包含一个整数表示从结点 s 到达 t 所需的最短时间。

【样例输入】

4 4 1 4
1 2 1 2 6
4 2 1 1 5
1 3 1 1 1
3 4 1 99 1

【样例输出】

11

【评测用例规模与约定】

对于 40% 的评测用例,n5001gi,ri,di100

对于 70% 的评测用例,n5000

对于所有评测用例,1n1000001m2000001s,tn1ui,vin1gi,ri,di109


【思路分析】

emmm😶,这个题说实话,题都有点没读明白。。

试题G:点亮(20分,10s,512MB)

【问题描述】

小蓝最近迷上了一款名为《点亮》的谜题游戏,游戏在一个 n × n 的格子棋盘上进行,棋盘由黑色和白色两种格子组成,玩家在白色格子上放置灯泡,确保任意两个灯泡不会相互照射,直到整个棋盘上的白色格子都被点亮(每个谜题均为唯一解)。灯泡只会往水平和垂直方向发射光线,照亮整行和整列,除非它的光线被黑色格子挡住。黑色格子上可能有从 0 到 4 的整数数字,表示与其上下左右四个相邻的白色格子共有几个灯泡;也可能没有数字,这表示可以在上下左右四个相邻的白色格子处任意选择几个位置放置灯泡。游戏的目标是选择合适的位置放置灯泡,使得整个棋盘上的白色格子都被照亮。

例如,有一个黑色格子处数字为 4,这表示它周围必须有 4 个灯泡,需要在他的上、下、左、右处分别放置一个灯泡;如果一个黑色格子处数字为 2,它的上下左右相邻格子只有 3 个格子是白色格子,那么需要从这三个白色格子中选择两个来放置灯泡;如果一个黑色格子没有标记数字,且其上下左右相邻格子全是白色格子,那么可以从这 4 个白色格子中任选出 0 至 4 个来放置灯泡。

题目保证给出的数据是合法的,黑色格子周围一定有位置可以放下对应数量的灯泡。且保证所有谜题的解都是唯一的。

现在,给出一个初始的棋盘局面,请在上面放置好灯泡,使得整个棋盘上的白色格子被点亮。

【输入格式】

输入的第一行包含一个整数 n,表示棋盘的大小。

接下来 n 行,每行包含 n 个字符,表示给定的棋盘。字符 . 表示对应的格子为白色,数字字符 0、1、2、3、4 表示一个有数字标识的黑色格子,大写字母 X 表示没有数字标识的黑色格子。

【输出格式】

输出 n 行,每行包含 n 个字符,表示答案。大写字母 O 表示对应的格子包含灯泡,其它字符的意义与输入相同。

【样例输入】

5
.....
.2.4.
..4..
.2.X.
.....

【样例输出】

...O.
.2O4O
.O4O.
.2OX. 
O....

【样例说明】

答案对应的棋盘布局如下图所示:

image-20220618170140173

【评测用例规模与约定】

对于所有评测用例,2n5,且棋盘上至少有15的格子是黑色格子。


【思路分析】

深搜?动规??不会,,要不是时间太紧,差点写爆破😂

试题H:打折(20分,15s,512MB)

【问题描述】

小蓝打算采购 n 种物品,每种物品各需要 1 个。

小蓝所住的位置附近一共有 m 个店铺,每个店铺都出售着各种各样的物品。

第 i 家店铺会在第si天至第ti天打折,折扣率为pi,对于原件为 b 的物品,折后价格为b·pj100。其它时间需按原价购买。

小蓝很忙,他只能选择一天的时间去采购这些物品。请问,他最少需要花多少钱才能买到需要的所有物品。

题目保证小蓝一定能买到需要的所有物品。

【输入格式】

输入的第一行包含两个整数 n, m,用一个空格分隔,分别表示物品的个数和店铺的个数。

接下来依次包含每个店铺的描述。每个店铺由若干行组成,其中第一行包含四个整数si,ti,pi,ci,相邻两个整数之间用一个空格分隔,分别表示商店优惠的起始和结束时间、折扣率以及商店内的商品总数。之后接ci 行,每行包含两个整数aj,bj,用一个空格分隔,分别表示该商店的第 j 个商品的类型和价格。商品的类型由 1 至 n 编号。

【输出格式】

输出一行包含一个整数表示小蓝需要花费的最少的钱数。

【样例输入】

2 2
1 2 89 1
1 97
3 4 77 1
2 15

【样例输出】

101

【评测用例规模与约定】

对于 40% 的评测用例,n,m500siti100ci2000

对于 70% 的评测用例,n,m5000ci20000

对于所有评测用例,1n,m1000001cinci4000001siti1091<pi<1001ajn1bj109


【思路分析】

又是一道看题目都费劲的题,,不过盲猜应该类似于背包问题。

GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

简介

本仓库存储在各个OJ平台及算法比赛中的代码及题解,具体可选择分支查看。目前包括计蒜客、蓝桥杯省赛、国赛等。主要语言为Python,其中也夹杂了少许Java。 展开 收起
README
GPL-3.0
取消

发行版

暂无发行版

贡献者 (1)

全部

语言

近期动态

接近2年前推送了新的提交到 leetcode 分支,b4c119d...6794094
3年前推送了新的提交到 leetcode 分支,f6d8ec7...b4c119d
3年前推送了新的 leetcode 分支
3年前推送了新的提交到 蓝桥杯_国赛 分支,5f86ee6...02bc42d
3年前推送了新的提交到 蓝桥杯_国赛 分支,e875ca0...5f86ee6
加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/ayo_yo/Algorithm.git
git@gitee.com:ayo_yo/Algorithm.git
ayo_yo
Algorithm
Algorithm
蓝桥杯_国赛

搜索帮助