牛客876865650号
牛客876865650号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客876865650号的博客
全部文章
/ 题解
(共7篇)
题解 | #删除字符串中出现次数最少的字符#
while True: try: n_count = [] n = input() # 找到每个字符串出现的次数 for i in n: n_count.append(n.count(i)) # 找到最小值 min_index = min(n_count) result = '' for i in ...
Python3
2022-02-26
0
263
题解 | #汽水瓶#
def bottle(n,sum_re): if n==3 or n ==2: sum_re +=1 return sum_re else: a = n//3 b = n%3+a sum_re += a return bottle(b, sum_re) list1 = [] while True: ...
Python3
2022-02-25
0
406
题解 | #最小花费爬楼梯#
while True: try: password = input() list1 = ['abc', 'def', 'ghi', 'jkl', '...
Python3
2022-02-25
20
854
题解 | #最小花费爬楼梯#
n = int(input()) cost = input().split(' ') for i in range(len(cost)): cost[i]=int(cost[i]) dp=[] if n==1: print(cost[0]) elif n==2: print(min(cost[0]...
Python3
Python3
2022-02-25
2
924
题解 | #字符个数统计#
n = int(input()) 占位 dp = [1,1] def qw_tj(n): if n==1 or n==2: print(1) return 1 for i in range(2,n): dp.append( dp[i-2] + dp[i-1]) print(dp[n-1]) qw_t...
Python3
2022-02-24
0
416
题解 | #字符个数统计#
n =int(input()) dp = [1,1] def fibonaci(a,b): return a+b if n==1 or n==2: print('1') else: for i in range(n-2): dp.append(fibonaci(dp[i], dp[i+1])) pr...
Python3
2022-02-24
3
755
题解 | #取近似值#
num = float(input()) num_int = int(num) num_float = num-num_int if num_float==0.5: if num_int%2==0: print(num_int+1) else: print(round(num)) else: pri...
Python3
2022-02-23
0
342