自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 收藏
  • 关注

原创 CCF python 线性分类器

n, m = map(int, input().split())list1 = []list2 = []for i in range(n): x, y, dot_type = input().split() x = int(x) y = int(y) list1.append((x, y, dot_type))for j in range(m): a1, a2, a3 = map(int, input().split()) list2.append.

2022-01-14 17:56:37 357

原创 CCF python 数组推导

n = int(input())list1 = list(map(int, input().split()))print(sum(list1))print(sum(set(list1)))

2022-01-14 12:14:54 273

原创 CCF python 序列查询

n, m = map(int, input().split())list1 = []list1 = list(map(int, input().split()))list1.insert(0, 0)num = 0s_num = 0for i in range(1, len(list1)): s_num = s_num + (list1[i] - list1[i-1]) * num num = num + 1s_sum = s_num + (m - list1[len(list1

2022-01-14 00:34:19 194

原创 CCF python 出现次数最多的数

n = int(input())list1 = list(map(int, input().split()))list1.sort()min_num = 0for i in range(n): num = list1.count(list1[i]) if num > min_num: min_num = num a = list1[i]print(a)

2022-01-13 23:33:59 134

原创 CCF python 相反数

n = int(input())list1 = list(map(int, input().split()))num = 0for i in range(n): for j in range(i+1, n): if abs(list1[i]) == abs(list1[j]) and list1[i] != list1[j]: num = num + 1print(num)

2022-01-13 23:14:45 214

原创 CCF python 相邻数对

n = int(input())list1 = list(map(int, input().split()))num = 0for i in range(n): for j in range(i, n): if abs(list1[i] - list1[j]) == 1: num = num + 1print(num)

2022-01-13 23:14:05 96

原创 CCF python 门禁系统

n = int(input())list1 = list(map(int, input().split()))dic = {}for i in range(n): if not list1[i] in dic.keys(): dic[list1[i]] = 1 else: dic[list1[i]] = dic[list1[i]] + 1 print(dic[list1[i]], end=" ")

2022-01-13 22:38:08 238

原创 CCF python 图像旋转

n, m = map(int, input().split())list1 = []for i in range(n): list1.append(list(map(int, input().split())))for i in range(m-1, -1, -1): for j in range(n): a = list1[j][i] print(a, end=' ') print()

2022-01-13 16:27:35 122

原创 CCF python 数列分段

n = int(input())list1 = list(map(int, input().split()))num = 0if n != 0: num = num + 1for i in range(1, n): if list1[i] != list1[i-1]: num = num + 1print(num)

2022-01-12 22:07:32 199

原创 CCF python 数位之和

n = int(input())num = 0while n != 0: num = num + n % 10 n = n // 10print(num)

2022-01-12 21:54:19 115

原创 CCF python 折点计数

n = int(input())list1 = list(map(int,input().split()))num = 0for i in range(1, n-1): if (list1[i-1] > list1[i] and (list1[i+1] > list1[i])) or\ (list1[i-1] < list1[i] and (list1[i+1] < list1[i])): num = num + 1print.

2022-01-12 21:46:37 141

原创 CCF python 最大波动

n = int(input())list1 = list(map(int, input().split()))difference = abs(list1[0] - list1[1])for i in range(2, n): if abs(list1[i] - list1[i-1]) > difference: difference = abs(list1[i] - list1[i-1])print(difference)

2022-01-12 21:26:57 96

原创 CCF python 中间数

n = int(input())list1 = list(map(int, input().split()))for i in range(n): low = 0 high = 0 for j in range(n): if list1[j] > list1[i]: high = high + 1 if list1[j] < list1[i]: low = low + 1 if .

2022-01-12 21:13:39 226

原创 CCF python 分蛋糕

n, k = map(int, input().split())list1 = list(map(int, input().split()))num = 0cake_num = 0for i in range(n): if num == 0: cake_num += 1 num = num + list1[i] if num >= k: num = 0print(cake_num)

2022-01-12 19:49:35 143

原创 CCF python 打酱油

N = int(input())num = 0if N >= 50: remainder = N % 50 quotient = N // 50 num = num + quotient * 7 if remainder >= 30: quotient = remainder // 30 remainder = remainder % 30 num = num + quotient * 4 if rem.

2022-01-12 16:55:01 127

原创 CCF python 最小差值

n = int(input())list1 = list(map(int, input().split()))difference = abs(list1[0] - list1[1])for i in range(n): for j in range(i+1, n): if difference > abs(list1[i] - list1[j]): difference = abs(list1[i] - list1[j])print(diff.

2022-01-12 16:30:56 205

原创 CCF python 跳一跳

list1 = []list1 = list(map(int, input().split()))k = 1num = 0for i in list1: if i == 1: num = num + 1 k = 1 elif i == 2: num = num + 2 * k k = k + 1print(num)

2022-01-10 23:22:37 278

原创 CCF python 灰度直方图

n, m, l, = map(int, input().split())list1 = []list2 = []for i in range(l): list1.append(0)for i in range(n): j = 0 list2 = list(map(int,input().split())) while j < m : if list2[j] < l: list1[list2[j]] += 1 .

2022-01-10 15:33:32 355

原创 CCF python 卖菜

n = int(input())list1 = list(map(int,input().split()))list2 = []for i in range(n): if(i==0): s=(list1[i]+list1[i+1])//2 list2.append(s) elif(i==(n-1)): s=(list1[i]+list1[i-1])//2 list2.append(s) elif(i>0 a.

2022-01-08 21:55:46 219

原创 CCF python 小明上学

r,y,g = map(int,input().split())n = int(input())s_time = 0for i in range(n): k,t = map(int,input().split()) if(k==0): s_time = s_time + t if(k==1): s_time = s_t

2022-01-08 11:16:49 235

原创 CCF python 小中大

n = int(input())list1 = list(map(int,input().split()))if(n%2==0): s = (list1[int(n/2)]+list1[int(n/2-1)])/2 if(s == int(s)): print(max(list1),int(s), min(list1)) else: s = int(int(s*100+5)/10)/10 print(max(list1), s, .

2022-01-08 10:57:57 375

原创 CCF python 小明种苹果

N,M = map(int,input().split())list2 = []s_num = 0for i in range(N): list1 = list(map(int,input().split())) num = list1[0] ss_num = 0 ss_num = sum(list1) - num for j in range(1,M+1): num = num + list1[j] s_num = s_num + n.

2022-01-08 09:42:13 338

原创 CCF python 期末预测之安全指数

n = int(input())num = 0for i in range(n): w,score = map(int,input().split()) num = num + w * scoreprint(max(0,num))

2022-01-05 12:46:35 332

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除