res = 0
for i in range(1,2021):
i = str(i)
res += i.count('2')
print(res)
答案是2
nums = [[2, 2, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 2, 2, 0, 2],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 2, 2],
[0, 0, 2, 0, 2, 0],
]
res = 0
for i in range(len(nums)): # 行
for j in range(len(nums[0])): # 列
if j + 4 <= len(nums[0]): # 超出了
a = nums[i][j:j+4]
if a == [2,0,2,0]:
res += 1
if i+3 < len(nums):
b = nums[i][j]*1000 + nums[i+1][j] * 100 + nums[i+2][j] *10 + nums[i+3][j]
if b == 2020:
res += 1
if i+3 < len(nums) and j+3 < len(nums[0]):
c = nums[i][j] * 1000 + nums[i+1][j+1] * 100 +nums[i+2][j+2] * 10 + nums[i+3][j+3]
if c ==2020:
res += 1
print(res)
import datetime
a = datetime.date(2000,1,1)
b = datetime.date(2020,10,2)
res = 0
while True:
if a == b: break
if a.day == 1:
res += 2
a = a + datetime.timedelta(days = 1)
continue
if a.isoweekday() == 1:
res += 2
a = a+datetime.timedelta(days = 1)
continue
res += 1
a = a + datetime.timedelta(days = 1)
print(res)
lst = [[] for _ in range(40)]
lst[0].append(1)
num=1
for i in range(2,40):
if i % 2 == 0:
for j in range(i):
num += 1
lst[j].append(num)
else:
for j in range(i):
num += 1
lst[i - j -1].append(num)
for i in range(len(lst)):
print(i + 1, lst[i])
print(lst[19][19])
print('jonmlkihgfedcba')
if __name__ == '__main__':
n = int(input())
jige = 0
youxiu = 0
for i in range(n):
m = int(input())
if m >= 85:
youxiu += 1
jige += 1
elif m >= 60:
jige += 1
print('{:.0f}%'.format((jige/n)*100))
print('{:.0f}%'.format((youxiu/n)*100))
import collections
s = input()
dic = collections.defaultdict(int) # 参数输int就可以计数
for i in s:
dic[i] += 1
dic = dict(dic.items())
dic = sorted(dic.items(),key= lambda x:x[0], reverse=False) # 先按字典序排 升序,排完就变成一个列表了
dic = sorted(dic, key = lambda x:x[1],reverse=True) # 再按大小排,这样就都排好了 降序
print(dic[0][0])
print(dic[0][1])
# 如果符合要求的话 n 为奇数只有最后一行的中间点符合 偶数只有中间两个点符合
if __name__ == '__main__':
n = int(input())
f,a = [[-1]*(n+1) for _ in range(n+1)],[[0] for _ in range(N)]
for i in range(1,n+1):
a[i] += [int(x) for x in input().split()]
f[1][1] = a[1][1]
for i in range(2,n+1): # 第i行
for j in range(1,i+1): # 第j列
f[i][j] = max(f[i-1][j] + a[i][j], f[i-1][j-1] + a[i][j])
if n % 2 == 0:
res = max(f[n][n//2],f[n][n//2+1])
else:
res = f[n][n//2+1]
print(res)
n = int(input())
lines = []
for i in range(n):
a, b = map(int, input().split())
lines.append((a, b))
lines = list(set(lines)) # 去重
def cross(line1,line2): # 求交点
A1,B1,A2,B2 = line1[0],line1[1],line2[0],line2[1]
if A1 - A2 == 0: return # 返回NONE
x = (B2 - B1) / (A1 - A2)
y = A1 * x + B1
x = round(x, 10)
y = round(y, 10)
return (x, y)
ci = [1] *(n+1) # 第i条直接加入对答案的贡献,下标从0开始,默认那个1就已经加上了
node = set()
for i in range(1,n): # 从第二条线开始
node.clear()
for j in range(i):
tmp = cross(lines[i],lines[j])
if tmp == None: continue
node.add(tmp)
ci[i] += len(node)
print(sum(ci[:n])+1) # 加上最开始其实是有两个平面,我们只算了一个
lv = [0]*5 # 表示等级为i的孔的数量
limit = [0]*5
value = [[0] for i in range(5)]
for i in range(6):
a = list(map(int,input().split()))
for i in range(1,len(a)):
lv[a[i]] += 1 #等级为i的物品+1
m = int(input())
for i in range(m):
zhu = list(map(int,input().split()))
limit[zhu[0]] = zhu[1] # limit[i] 表示等级为i的珠子最多镶嵌多少个
value[zhu[0]] += zhu[2:] # value[i][j] 表示等级为i的珠子用了j个的价值
res = 0
# 对每个珠子的等级进行枚举
for i in range(min(lv[4],limit[4])+1): # 等级为4的选i个
for j in range(min(lv[3] + lv[4] - i,limit[3])+1): # 等级为3的珠子能放进3和4的孔中
for k in range(min(lv[4] + lv[3] + lv[2] -i -j,limit[2])+1):
for l in range(min(lv[4] + lv[3] + lv[2] + lv[1] -i -j -k,limit[1])+1):
res = max(res,value[4][i] + value[3][j] + value[2][k] + value[1][l])
print(res)
lv = [0]*5 # 表示等级为i的孔的数量
limit = [0]*5
value = [[0] for i in range(5)]
# print(summ)
for i in range(6):
a = list(map(int,input().split()))
for i in range(1,len(a)):
lv[a[i]] += 1 #等级为i的物品+1
m = int(input())
for i in range(m):
zhu = list(map(int,input().split()))
limit[zhu[0]] = zhu[1] # limit[i] 表示等级为i的珠子最多镶嵌多少个
value[zhu[0]] += zhu[2:] # value[i][j] 表示等级为i的珠子用了j个的价值
res = 0
# 对每个珠子的等级进行枚举
for i in range(min(lv[4],limit[4])+1): # 等级为4的选i个
for j in range(min(lv[3] + lv[4] - i,limit[3])+1): # 等级为3的珠子能放进3和4的孔中
for k in range(min(lv[4] + lv[3] + lv[2] -i -j,limit[2])+1):
for l in range(min(lv[4] + lv[3] + lv[2] + lv[1] -i -j -k,limit[1])+1):
res = max(res,value[4][i] + value[3][j] + value[2][k] + value[1][l])
print(res)