燕草如碧
燕草如碧
全部文章
分类
题解(60)
归档
标签
去牛客网
登录
/
注册
燕草如碧的博客
全部文章
(共63篇)
题解 | #字符串操作#
抄作业,稍有改动 n,m =map(int,input().split()) str1 =[i for i in input()] for i in range(m): l,r,ch1,ch2 = input().split() for j in range(int(l)-1,int...
Python3
2022-06-23
1
351
题解 | #[NOIP2008]笨小猴#数据结构dic和set 注释详细
使用dic和set数据结构解出,详细可看注释 # 字典非手写,同学请注意 def isPrime(num):#判断质数的函数 if num == 1 or num ==0: return False for i in range(2,num): if ...
Python3
2022-06-23
1
465
题解 | #扫雷#有限状态机
想用有限状态机解的,但是算法循环多了,导致超时 row,col = map(int,input().split()) minetb = [[0 for _ in range (col)] for _ in range(row) ] state = 0 x,y=0,0 allstate = [[0,1...
Python3
2022-06-22
0
385
题解 | #井字棋#抄作业
楼上太牛,直接抄作业,改都不用改,太完美了,. l=[] for i in range(3): l.extend(input().split()) lk = ['K','K','K'] lb = ['B','B','B'] n=[l[0:3],l[3:6],l[6:9],l[0::3],l[...
Python3
2022-06-22
1
235
题解 | #杨辉三角#
我用遍历二维数组做出来的,楼上用append做出来实在佩服啊 n = int(input()) a = [[1 for _ in range(n)] for _ in range(n)] for i in range(0,n): for j in range(0,i+1): ...
Python3
2022-06-22
2
647
题解 | #矩阵交换#简单是简单就是太长了
奉上我的垃圾代码,简单是简单就是太长了 row,col = map(int,input().split()) tmp = [0 for _ in range(col)] tmp2 = 0 matrix = [[0 for _ in range(col)]for _ in range(row)] f...
Python3
2022-06-22
0
300
题解 | #矩阵转置#二维数组
我坚持二维数组 row,col = map(int,input().split()) matrix1 = [[0 for _ in range(col)] for _ in range(row)] matrix2 = [[0 for _ in range(row)] for _ in range(...
Python3
2022-06-22
1
481
题解 | #序列重组矩阵#Python
能一行解决,绝不两行 row,col = map(int,input().split()) matrix = list(map(int,input().split())) for index,i in enumerate(matrix): if (index)%col == 0: ...
Python3
2022-06-22
2
316
题解 | #图像相似度#二维数组解法
题目不是应该用二位数组解吗?同志们 row,col = map(int,input().split()) pic1 = [[0 for _ in range(0,col)]for _ in range(0,row)] pic2 = [[0 for _ in range(0,col)]for _ in...
Python3
2022-06-22
1
356
题解 | #蛇形矩阵#有限状态机解蛇形矩阵
看注释解析还是比较简单的,只有4条规则约束 n = int(input()) state = 0 x,y=0,0 position=[[-1 for _ in range(0,n)] for _ in range(0,n)] trace=[] cnt = 0 allstate=[[1,-1],[-1...
Python3
2022-06-22
1
294
首页
上一页
1
2
3
4
5
6
7
下一页
末页