兰州新区建设厅网站,网页版传奇怎么开,pc网站手机网站app,wordpress收费版怎么激活1.
小蓝正在学习一门神奇的语言#xff0c;这门语言中的单词都是由小写英文字母组 成#xff0c;有些单词很长#xff0c;远远超过正常英文单词的长度。小蓝学了很长时间也记不住一些单词#xff0c;他准备不再完全记忆这些单词#xff0c;而是根据单词中哪个字母出现得最…1.
小蓝正在学习一门神奇的语言这门语言中的单词都是由小写英文字母组 成有些单词很长远远超过正常英文单词的长度。小蓝学了很长时间也记不住一些单词他准备不再完全记忆这些单词而是根据单词中哪个字母出现得最多来分辨单词。
现在请你帮助小蓝给了一个单词后帮助他找到出现最多的字母和这 个字母出现的次数。
wordinput()
count0
arr[]
for i in word:countsword.count(i)if countscount:countcounts
for j in word:if word.count(j)count:arr.append(j)
arr.sort()
print(arr[0])
print(count)
2.成绩统计
补充知识点round()
round()是python自带的一个函数用于数字的四舍五入。
numint(input())
pass_num0
good_num0
for i in range(num):scoreint(input())if score60:pass_numpass_num1if score85:good_numgood_num1
pass1round((pass_num/num)*100)
good1round((good_num/num)*100)
print({}%.format(pass1))
print({}%.format(good1))
3.
补充知识点 abs(x)
abs(x) 是 Python 的一个内置函数它的功能是返回一个数的绝对值常用在数学计算中。绝对值是指一个数在数轴上所对应点到原点的距离是一个非负数。 补充知识点 math.gcd() 方法
math.gcd()方法是数学模块的一种库方法用于查找给定数字的GCD(最大公约数)它接受两个整数并返回其最大公约数(将两个数字相除的最大正整数)。
lcm(最小公倍数) 求解lcm时通常用gcd进行辅助计算。 定理两个自然数的最大公约数与它们的最小公倍数的乘积等于这两个数的乘积。 def Dijkstra(network,s,d): #迪杰克斯拉算法算s-d的最短路径并返回路径和代价print(Start Dijkstra Path...)path[] #s-d的最短路径nlen(network) #邻接矩阵维度即节点个数fmax999w[[0 for i in range(n)]for j in range(n)] #邻接矩阵转化为维度矩阵即0-maxbook[0 for i in range(n)] #是否已经是最小的标记列表dis[fmax for i in range(n)] #s 到其他节点的最小距离book[s-1]1 #节点编号从1开始列表序号从0开始midpath[-1 for i in range(n)] #上一跳列表for i in range(n):for j in range(n):if network[i][j]!0:w[i][j]network[i][j] #0-maxelse:w[i][j]fmaxif is-1 and network[i][j]!0: #直连的节点最小距离就是network[i][j]dis[j]network[i][j]for i in range(n-1): #n-1次遍历除了s节点minfmaxfor j in range(n):if book[j]0 and dis[j]min: #如果未遍历且距离最小mindis[j]ujbook[u]1for v in range(n): #u直连的节点遍历一遍if dis[v]dis[u]w[u][v]:dis[v]dis[u]w[u][v]midpath[v]u1 #上一跳更新jd-1 #j是序号path.append(d) #因为存储的是上一跳所以先加入目的节点d最后倒置while(midpath[j]!-1):path.append(midpath[j])jmidpath[j]-1path.append(s)path.reverse() #倒置列表print(path)#print(midpath)print(dis)#return pathnetwork[[0,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0],[1,0,0,3,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0],[1,0,3,0,1,0,2,1,2,0,0,0,0,0,0,0,0,0,0],[1,0,0,1,0,0,0,1,3,0,0,0,0,0,0,0,0,0,0],[0,0,3,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0],[0,1,3,2,0,1,0,0,0,0,2,3,0,1,0,0,0,0,0],[0,0,0,1,1,0,0,0,1,0,0,2,0,0,0,0,0,0,0],[0,0,0,0,3,0,3,1,0,0,0,0,3,0,0,0,0,0,0],[0,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2],[0,0,0,0,0,0,2,0,0,0,0,3,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,2,0,0,3,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,3,0,0,1,0,2,0,0,1,0,1],[0,0,0,0,0,0,0,0,0,0,1,0,2,0,0,1,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,3,0],[0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,1],[0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,1]
]
Dijkstra(network,1,19)
#弗洛一德算法# 请在此输入您的代码
M 999
matrix [[0, 2, 1, 1, 1, M, M, M, M, M, M, M, M, M, M, M, M, M, M],[2, 0, M, M, M, M, 1, M, M, 2, M, M, M, M, M, M, M, M, M],[1, M, 0, 3, M, 3, 3, M, M, M, M, M, M, M, M, M, M, M, M],[1, M, 3, 0, 1, M, 2, 1, 2, M, M, M, M, M, M, M, M, M, M],[1, M, M, 1, 0, M, M, 1, 3, M, M, M, M, M, M, M, M, M, M],[M, M, 3, M, M, 0, 1, M, M, M, M, M, M, M, M, M, M, M, M],[M, 1, 3, 2, M, 1, 0, M, 3, M, M, M, M, M, M, M, M, M, M],[M, M, M, 1, 1, M, M, 0, 1, M, M, 2, M, M, M, M, M, M, M],[M, M, M, 2, 3, M, 3, 1, 0, M, M, M, M, M, M, M, M, M, M],[M, 2, M, M, M, 1, M, M, M, 0, M, M, M, M, M, M, M, M, 2],[M, M, M, M, M, M, 2, M, M, M, 0, 3, M, 1, M, 2, M, M, M],[M, M, M, M, M, M, M, 2, M, M, 3, 0, 1, M, M, M, M, 1, M],[M, M, M, M, M, M, M, M, 3, M, M, 1, 0, 2, M, M, 1, M, 1],[M, M, M, M, M, M, M, M, M, M, 1, M, 2, 0, M, 1, M, M, M],[M, M, M, M, M, M, M, M, M, M, M, M, M, M, 0, 1, 1, 3, M],[M, M, M, M, M, M, M, M, M, M, 2, M, M, 1, 1, 0, M, M, M],[M, M, M, M, M, M, M, M, M, M, M, M, 1, M, 1, M, 0, M, M],[M, M, M, M, M, M, M, M, M, M, M, 1, M, M, 3, M, M, 0, 1],[M, M, M, M, M, M, M, M, M, 2, M, M, 1, M, M, M, M, 1, 0],
]
n len(matrix)
for i in range(n):for j in range(n):for k in range(n):matrix[i][j] min(matrix[i][j], matrix[i][k] matrix[k][j])
print(matrix[0][18])
4. 小明刚刚找到工作老板人很好只是老板夫人很爱购物。老板忙的时候经常让小明帮忙到商场代为购物。小明很厌烦但又不好推辞。
这不大促销又来了老板夫人开出了长长的购物单都是有打折优惠的。
小明也有个怪癖不到万不得已从不刷卡直接现金搞定。
现在小明很心烦请你帮他计算一下需要从取款机上取多少现金才能搞定这次购物。
取款机只能提供 100元面额的纸币。小明想尽可能少取些现金够用就行了。 你的任务是计算出小明最少需要取多少现金。
以下是让人头疼的购物单为了保护隐私物品名称被隐藏了。 python ceil 函数是返回值上限的X - 不小于x的最小整数。 说明
这个函数返回值上限的X - 不小于x的最小整数。
语法
import math
math.ceil( x )
注此功能是不能直接访问的所以我们需要导入的数学模块然后我们需要调用这个函数用数学的静态对象。
import math
arr
**** 180.90 88折
**** 10.25 65折
**** 56.14 9折
**** 104.65 9折
**** 100.30 88折
**** 297.15 半价
**** 26.75 65折
**** 130.62 半价
**** 240.28 58折
**** 270.62 8折
**** 115.87 88折
**** 247.34 95折
**** 73.21 9折
**** 101.00 半价
**** 79.54 半价
**** 278.44 7折
**** 199.26 半价
**** 12.97 9折
**** 166.30 78折
**** 125.50 58折
**** 84.98 9折
**** 113.35 68折
**** 166.57 半价
**** 42.56 9折
**** 81.90 95折
**** 131.78 8折
**** 255.89 78折
**** 109.17 9折
**** 146.69 68折
**** 139.33 65折
**** 141.16 78折
**** 154.74 8折
**** 59.42 8折
**** 85.44 68折
**** 293.70 88折
**** 261.79 65折
**** 11.30 88折
**** 268.27 58折
**** 128.29 88折
**** 251.03 8折
**** 208.39 75折
**** 128.88 75折
**** 62.06 9折
**** 225.87 75折
**** 12.89 75折
**** 34.28 75折
**** 62.16 58折
**** 129.12 半价
**** 218.37 半价
**** 289.69 8折arrarr.split()
sum0
for i in range(0,len(arr),3):datafloat(arr[i1])discountarr[i2]if len(discount)2:if discount半价:discount0.5else :discountfloat(discount[:-1])*0.1else:discountfloat(discount[:-1])*0.01sumsumdata*discount
print(math.ceil(sum/100)*100)
文章转载自: http://www.morning.pmtky.cn.gov.cn.pmtky.cn http://www.morning.myfwb.cn.gov.cn.myfwb.cn http://www.morning.kfysh.com.gov.cn.kfysh.com http://www.morning.fpjxs.cn.gov.cn.fpjxs.cn http://www.morning.qmmfr.cn.gov.cn.qmmfr.cn http://www.morning.wfbnp.cn.gov.cn.wfbnp.cn http://www.morning.bhwz.cn.gov.cn.bhwz.cn http://www.morning.rqlf.cn.gov.cn.rqlf.cn http://www.morning.knlyl.cn.gov.cn.knlyl.cn http://www.morning.lqrpk.cn.gov.cn.lqrpk.cn http://www.morning.yymlk.cn.gov.cn.yymlk.cn http://www.morning.qpnmd.cn.gov.cn.qpnmd.cn http://www.morning.nktxr.cn.gov.cn.nktxr.cn http://www.morning.tfznk.cn.gov.cn.tfznk.cn http://www.morning.hgcz.cn.gov.cn.hgcz.cn http://www.morning.zkdbx.cn.gov.cn.zkdbx.cn http://www.morning.slwqt.cn.gov.cn.slwqt.cn http://www.morning.rttkl.cn.gov.cn.rttkl.cn http://www.morning.rjtmg.cn.gov.cn.rjtmg.cn http://www.morning.llfwg.cn.gov.cn.llfwg.cn http://www.morning.fgrcd.cn.gov.cn.fgrcd.cn http://www.morning.phlwj.cn.gov.cn.phlwj.cn http://www.morning.pfgln.cn.gov.cn.pfgln.cn http://www.morning.gfrjs.cn.gov.cn.gfrjs.cn http://www.morning.tynqy.cn.gov.cn.tynqy.cn http://www.morning.gqjqf.cn.gov.cn.gqjqf.cn http://www.morning.fhddr.cn.gov.cn.fhddr.cn http://www.morning.bflwj.cn.gov.cn.bflwj.cn http://www.morning.tgwfn.cn.gov.cn.tgwfn.cn http://www.morning.qcwrm.cn.gov.cn.qcwrm.cn http://www.morning.nfpct.cn.gov.cn.nfpct.cn http://www.morning.pmbcr.cn.gov.cn.pmbcr.cn http://www.morning.wfttq.cn.gov.cn.wfttq.cn http://www.morning.ndcf.cn.gov.cn.ndcf.cn http://www.morning.mcwgn.cn.gov.cn.mcwgn.cn http://www.morning.qkrqt.cn.gov.cn.qkrqt.cn http://www.morning.hmfxl.cn.gov.cn.hmfxl.cn http://www.morning.phnbd.cn.gov.cn.phnbd.cn http://www.morning.ruyuaixuexi.com.gov.cn.ruyuaixuexi.com http://www.morning.pszw.cn.gov.cn.pszw.cn http://www.morning.mhfbp.cn.gov.cn.mhfbp.cn http://www.morning.gtcym.cn.gov.cn.gtcym.cn http://www.morning.fydsr.cn.gov.cn.fydsr.cn http://www.morning.bksbx.cn.gov.cn.bksbx.cn http://www.morning.bmpjp.cn.gov.cn.bmpjp.cn http://www.morning.swkzk.cn.gov.cn.swkzk.cn http://www.morning.nwnbq.cn.gov.cn.nwnbq.cn http://www.morning.jjzbx.cn.gov.cn.jjzbx.cn http://www.morning.bydpr.cn.gov.cn.bydpr.cn http://www.morning.yksf.cn.gov.cn.yksf.cn http://www.morning.jzklb.cn.gov.cn.jzklb.cn http://www.morning.whothehellami.com.gov.cn.whothehellami.com http://www.morning.pnljy.cn.gov.cn.pnljy.cn http://www.morning.hjjfp.cn.gov.cn.hjjfp.cn http://www.morning.nlywq.cn.gov.cn.nlywq.cn http://www.morning.rcttz.cn.gov.cn.rcttz.cn http://www.morning.skkln.cn.gov.cn.skkln.cn http://www.morning.rqfzp.cn.gov.cn.rqfzp.cn http://www.morning.plqqp.cn.gov.cn.plqqp.cn http://www.morning.bpmtj.cn.gov.cn.bpmtj.cn http://www.morning.hypng.cn.gov.cn.hypng.cn http://www.morning.znlhc.cn.gov.cn.znlhc.cn http://www.morning.cpmwg.cn.gov.cn.cpmwg.cn http://www.morning.zdtfr.cn.gov.cn.zdtfr.cn http://www.morning.lynkz.cn.gov.cn.lynkz.cn http://www.morning.kjxgc.cn.gov.cn.kjxgc.cn http://www.morning.frzdt.cn.gov.cn.frzdt.cn http://www.morning.wypyl.cn.gov.cn.wypyl.cn http://www.morning.fbxlj.cn.gov.cn.fbxlj.cn http://www.morning.jmbfx.cn.gov.cn.jmbfx.cn http://www.morning.wfwqr.cn.gov.cn.wfwqr.cn http://www.morning.rwmp.cn.gov.cn.rwmp.cn http://www.morning.jbxfm.cn.gov.cn.jbxfm.cn http://www.morning.wcqkp.cn.gov.cn.wcqkp.cn http://www.morning.ccpnz.cn.gov.cn.ccpnz.cn http://www.morning.jtmrx.cn.gov.cn.jtmrx.cn http://www.morning.chongzhanggui.cn.gov.cn.chongzhanggui.cn http://www.morning.mqxrx.cn.gov.cn.mqxrx.cn http://www.morning.gcqdp.cn.gov.cn.gcqdp.cn http://www.morning.tgczj.cn.gov.cn.tgczj.cn