牛客912492032号
牛客912492032号
全部文章
分类
题解(14)
归档
标签
去牛客网
登录
/
注册
牛客912492032号的博客
全部文章
(共10篇)
Python3 杨辉三角变形 找规律
虽然,找规律着实有点投机取巧,哈哈,但确实简单管用。规律:n:输入的行数;(n-2)%4 满足:{1:2,2:3,3:2,0:4}代码如下: while True: try: n = int(input()) dict_map = {1:2,2:3,3:2,0...
2021-04-07
0
752
Python3 计算字符串距离
使用动态规划计算,具体内容参见博客:https://www.jianshu.com/p/9a53f32cf62b def editDistance(str1, str2): ''' 计算字符串str1和str2的编辑距离 ''' edit = [[i+j for j ...
2021-04-06
11
1171
Python3 图片整理
while True: try: n = str(input()) s1 = sorted([ord(n[i]) for i in range(len(n))]) s2 = '' for i in range(len(s1)):...
2021-04-01
0
562
Python3 取近似值
import math while True: try: n = float(input()) if n % 1 == 0.5: print(math.ceil(n)) else: print(r...
2021-03-29
0
531
质数因子计算
while True: try: n=int(input()) i = 2 while i * i <= n: while n % i == 0: n = n / i ...
2021-03-29
5
696
牛客的课程订单分析(七)
select source,count(source) as cnt from (select o.id,case c.id when 1 then "PC" when 2 then "Android" whe...
sql
2021-03-15
1
672
牛客的课程订单分析(六)
select o.id,o.is_group_buy, case when o.is_group_buy="Yes" then NULL else c.name end as client_name from order_info o left join client c on o...
sql
2021-03-15
2
685
mysql添加唯一索引+普通索引
使用 mysql alter 创建索引,代码如下: alter table actor add unique uniq_index_firstname (first_name); alter table actor add index idx_lastname(last_name);结果没通过...
sql
2021-03-04
0
1291
字符串分隔
import sys import re for i in range(2): line = sys.stdin.readline().strip() strs = re.findall(r'.{8}', line) if len(strs)*8!=len(line): ...
2020-05-29
0
369
Python3明明的随机数
import sys getline = lambda: sys.stdin.readline().strip() #利用lambda定义读取数据函数 line = getline() while line: s = [int(getline()) for i in range(int(li...
2020-05-29
19
1793