当前位置: 首页 > news >正文

做自动发货网站/长沙网络推广只选智投未来

做自动发货网站,长沙网络推广只选智投未来,建设网站沙井,中国建设银行北京分行网站以下作业题仅为参考答案 为了锻炼思维的目的 所有的底层操作都是独立实现 尽量少的引包 大家对题有更好的思路和更方便的包欢迎大家多多留言 祝愿大家共同进步1 hello word 略… 2A B A int(input())B int以下作业题仅为参考答案,为了锻炼思维的目的,所有…

以下作业题仅为参考答案 为了锻炼思维的目的 所有的底层操作都是独立实现 尽量少的引包 大家对题有更好的思路和更方便的包欢迎大家多多留言 祝愿大家共同进步1 hello word 略… 2A B A int(input())B int

以下作业题仅为参考答案,为了锻炼思维的目的,所有的底层操作都是独立实现,尽量少的引包,大家对题有更好的思路和更方便的包欢迎大家多多留言,祝愿大家共同进步

2f52bf982ba314678cc0bcec17480948.png

1 hello word

略…

2A+B

c59db3557bb6356a0e7aa87b75faf973.png

A = int(input())

B = int(input())

print(A+B)

3N位小数

01759ff82a42e84be237bb814a394ec1.png

f = float(input())

n = int(input())

print(round(f,n))

4二进制(题目错误,只要第二个输出的也是a的二进制题目就能通过)

7cadad35ccea61ab5a9c2248c6319251.png

调用函数

a = int(input())

b = int(input())

print(bin(a),bin(b),a & b)

全部自己实现

a = int(input())

b = int(input())

def toBin(num):

s = ""

while num > 0:

s += str(num&1)

num >>= 1

l = list(s)

l.reverse()

return "".join(l)

print("0b"+toBin(a))

print("0b"+toBin(b))

5ASCII

e47dcdfa1444f9161c8349119f68bcc9.png

n = int(input())

a = input()

print(chr(n),ord(a))

6进制转换

21b296d0e5fd12fef204455d7417c441.png

n = int(input())

print(oct(n), hex(n),bin(n), sep = ",")

7整数格式输出

9e1580af682bbfdad3fe81deb90a59d4.png

a = int(input())

print("{:<10d}".format(a))

print("{:>10d}".format(a))

print("{:

print("{:>+10d}".format(abs(a)))

8浮点数输出

50472e26de9fe049ef2dabe52f0512cb.png

a = float(input())

print("{:<.6f sep="/">

9各种表示

1543d00685fc9504d2ea137c14af4ea6.png

a = int(input())

print('{:b}'.format(a), '{:o}'.format(a), oct(a), '{:x}'.format(a), hex(a), '{:#X}'.format(a), sep = ",")

10动态宽度

d196ffcd3f748a4dc7baff9729445747.png

m = int(input())

n = int(input())

def toBin(num):

s = ""

for i in range(0, n):

s += str(num&1)

num >>= 1

l = list(s)

l.reverse()

return "".join(l)

print(toBin(m))

11两个分数加减乘除

1b2505043fbc8d5238f09e65805dfe5e.png

a = int(input())

b = int(input())

c = int(input())

d = int(input())

def simple(d):

a = d['molecule']

b = d['denominator']

while a%b != 0:

tmp=a%b

a = b

b = tmp

d['molecule'] /= b

d['denominator'] /= b

dict = {'molecule':a*d+b*c, 'denominator':b*d}

simple(dict)

print("("+str(a)+"/"+str(b)+")"+"+("+str(c)+"/"+str(d)+")"+"="+str(int(dict['molecule']))+"/" + str(int(dict['denominator'])))

dict['molecule'] = a*d-b*c

simple(dict)

print("("+str(a)+"/"+str(b)+")"+"-("+str(c)+"/"+str(d)+")"+"="+str(int(dict['molecule']))+"/" + str(int(dict['denominator'])))

dict['molecule'] = a*c

simple(dict)

print("("+str(a)+"/"+str(b)+")"+"*("+str(c)+"/"+str(d)+")"+"="+str(int(dict['molecule']))+"/" + str(int(dict['denominator'])))

dict['molecule'] = a*d

dict['denominator'] = b*c

simple(dict)

print("("+str(a)+"/"+str(b)+")"+"/("+str(c)+"/"+str(d)+")"+"="+str(int(dict['molecule']))+"/" + str(int(dict['denominator'])))

12计算狗的年龄

5a81fa5ead188a36f1450bb2b6eb8535.png

a = int(input())

if a<=2:

print(a*10.5)

else:

print(int(2*10.5+(a-2)*4))

13风寒指数

b75f1fad2bf81986b3bde8f2ff513f4f.png

import math

v = float(input())

t = float(input())

chill = 13.12+0.6215*t-11.37*math.pow(v, 0.16)+0.3965*t*math.pow(v, 0.16)

print(round(chill))

14圆柱

8be45c5589e6c92e2719ed2950995ced.png

import math

h = float(input())

r = float(input())

pai = 3.14159265

print("{:.4f}".format(pai*pow(r, 2)*h))

print("{:.4f}".format(pai*pow(r, 2)*2+2*pai*r*h))

15直角坐标转换为极坐标

6554695d326095034f449f430b941566.png

import math

x = float(input())

y = float(input())

print("{:.4f}".format(math.sqrt(pow(x, 2)+pow(y, 2))), "{:.4f}".format(math.atan2(y, x)), sep = ",")

16给定经纬度计算地球上两点之间的距离

e357be13d4b74e2a4a70ac9f1f0726d7.png

import math

latitude1 = math.radians(float(input()))

longitude1 = math.radians(float(input()))

latitude2 = math.radians(float(input())) #纬度

longitude2 = math.radians(float(input())) #经度

#经纬度转换弧度

def har(th):

return math.pow(math.sin(th/2), 2)

#求差值

vlon = abs(longitude1 - longitude2)

vlat = abs(latitude1 - latitude2)

h = har(vlat)+math.cos(latitude1)*math.cos(latitude2)*har(vlon)

print("{:.4f}".format(2*6371*math.asin(math.sqrt(h))), "km", sep = "")

17勾股定理

ff9388013cf1836f27f6c0de3194a38a.png

import math

a = int(input())

b = int(input())

max = a if a>b else b

min = a if a

def isTriangle(a, b, c):

if a+b > c and a+c > b and b+c > a and abs(a-b) < c and abs(a-c) < b and abs(c-b) < a:

return True

else:

return False

condition1 = int(math.sqrt(math.pow(max, 2) - math.pow(min,2)))

condition2 = int(math.sqrt(math.pow(max, 2) + math.pow(min,2)))

if(isTriangle(min, max, condition2) and math.pow(min, 2)+math.pow(max, 2) == math.pow(condition2, 2) and condition2 > max):

print("c")

elif(isTriangle(min, max, condition1) and math.pow(min, 2)+math.pow(condition1, 2) == math.pow(max, 2) ):

if condition1

print("a")

if condition1min:

print("b")

else:

print("non")

18RGB转换HSV

fbf2c024f2182e8c15330d9d704d280d.png

R = int(input())/255

G = int(input())/255

B = int(input())/255

def max(a, b, c):

m = a if a > b else b

m = m if m > c else c

return m

def min(a, b, c):

m = a if a < b else b

m = m if m < c else c

return m

V = maximum = max(R, G, B)

minimum = min(R, G, B)

S = (maximum - minimum)/maximum

if maximum == R:

H = (G-B)/(V-minimum)

if maximum == G:

H = 2+(B-R)/(maximum-minimum)

if maximum == B:

H = 4+(R-G)/(maximum-minimum)

H *= 60

if H<0:

H += 360

print("{:.4f}".format(H), "{:.4%}".format(S), "{:.4%}".format(V), sep = ",")

19比率

3c52089bae05436b55383f267ed5943e.png

f = float(input())

# 分数通分

def simple(d):

a = d['molecule']

b = d['denominator']

while a%b != 0:

tmp=a%b

a = b

b = tmp

d['molecule'] /= b

d['denominator'] /= b

# 判断小数位有几位

len = len(str(f))-len(str(int(f)))-1

dict = {'molecule':f*pow(10, len), 'denominator':pow(10, len)}

simple(dict)

print(str(int(dict['molecule']))+"/" + str(int(dict['denominator'])))

20.指定精度输入

7dc202e2862bdd20870b502f8a65a06e.png

f = float(input())

n = int(input())

s = str(f)[0:len(str(int(f)))+n+2]

if(int(s[len(s)-1])>4):

s2 = str(int(s[len(s)-2])+1)

else:

s2 = str(int(s[len(s)-2]))

s = s[0:len(str(int(f)))+n]+s2

print(s)

21.整数组合

90f669ed5fe13dd3bb2acb37479283e1.png

import math

n = int(input())

m = int(input())

sum = 0

for i in range(m):

sum += n*int(math.pow(10, i))*(m-i)

print(sum)

# 解法为按位计算,第一次循环统计各位,第二次十位以此类推...每一位的个数随循环减少

# 555

# 55

# 5

# pow(10, i)效率还可以提升,利用迭代

sum = 0

tmp = 1

for i in range(m):

sum += n*tmp*(m-i)

tmp *= 10

print(sum)

22.组合数

0f0136672ab7a3a4fba8b93ad13d0701.png

n = int(input())

count = 0

for a in range(10):

for b in range(10):

for c in range(10):

d = n-a-b-c

if 0 <= d <= 9:

count += 1

print(count)

23对称数

e80b5602d72f75f405118e8775f24750.png

integer = int(input())

def isSymmetry(a, b):

if (a=='9'and b=='6') or (a=='6'and b=='9') or a == b:

return True

else:

return False

flag = True

for i in range(len(str(integer))>>1):

if False == isSymmetry(str(integer)[i], str(integer)[len(str(integer))-i-1]):

flag = False

if flag:

print("Yes")

else:

print("No")

24.平行线

0f825640386fc2d3eec11cd588f2f3a2.png

x1 = float(input())

y1 = float(input())

x2 = float(input())

y2 = float(input())

x3 = float(input())

y3 = float(input())

x4 = float(input())

y4 = float(input())

if(y2-y1)/(x2-x1) == (y4-y3)/(x4-x3):

print("Yes")

else:

print("No")

25.阶乘末尾

472d7e9d6d59175dfd33ba8fac675536.png

n = int(input())

product = 1

for i in range(1, n+1):

product *= i

num = 0

for i in range(len(str(product))):

if('0' == str(product)[len(str(product))-i-1]):

num+=1

else:

break

print(num)

26.操作数

ee9a194059487dd99fc1a250125d1e68.png

n = int(input())

def count(n):

sum = 0

while(n > 0):

sum += int(n%10)

n /= 10

return sum

nums = 0

while n>0:

n -= count(n)

nums += 1

print(nums)

27.斐波那契数列

432a282d42485aaeae915a07bb7c38a4.png

n = int(input())

def fib(n):

if 1 == n or 2 == n:

return 1

a = 0

b = 1

c = 1

for i in range(n-2):

a = b

b = c

c = a+b

return c

print(fib(n))

28.圆

f0d2c287a673e3eb108854c7f20d13cd.png

import math

x1 = int(input())

y1 = int(input())

x2 = int(input())

y2 = int(input())

x3 = int(input())

y3 = int(input())

a=2*(x2-x1)

b=2*(y2-y1)

c=2*(x3-x2)

d=2*(y3-y2)

e=x2*x2+y2*y2-x1*x1-y1*y1

f=x3*x3+y3*y3-x2*x2-y2*y2

x=(b*f-d*e)/(b*c-d*a)

y=(c*e-a*f)/(b*c-d*a)

r=math.sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1))

print("{:.3f}".format(r), "{:.3f}".format(x), "{:.3f}".format(y), sep = ",")

29.回文数

67d34aa5975fac5203cbd11c65c6ec06.png

integer = int(input())

def isSymmetry(a, b):

if a == b:

return True

else:

return False

flag = True

for i in range(len(str(integer))>>1):

if False == isSymmetry(int(str(integer)[i]), int(str(integer)[len(str(integer))-i-1])):

flag = False

if flag:

print("Yes")

else:

print("Not")

代码改进

n = int(input())

s = str(n)

res = ""

for i in range(len(str(n))):

res += str(s[i])

if int(res) == n:

print("Yes")

else:

print("Not")

30.方程组

0a17acaa84e0955f50b28daa2b54b690.png

a = float(input())

b = float(input())

c = float(input())

d = float(input())

e = float(input())

f = float(input())

if a/d == b/e and a/d != c/f:

print("error")

else:

x=(c*e-f*b)/(a*e-d*b)

y=(c*d-a*f)/(b*d-e*a)

print("{:.3f}".format(x), "{:.3f}".format(y), sep = " ")

以上信息来源于网络,如有侵权,请联系站长删除。

http://www.lbrq.cn/news/1116073.html

相关文章:

  • 集团公司网站建设策划/google下载安卓版
  • 河南建设银行处理违章网站/搜索引擎推广与优化
  • 成品网站w灬源码1688网页版/阿里云建站费用
  • 广东广州电脑个人建站/看网站搜什么关键词
  • 清远专业网站建设/怎么在百度做宣传广告
  • 国内最大网站制作公司/百度seo 站长工具
  • 空间注册网站/百度关键词排名查询接口
  • 北京 个人网站 备案/品牌运营管理公司
  • 留住用户网站/什么是软文营销?
  • 天涯武汉论坛/网站seo教材
  • 邯郸小学网站建设/抖音搜索优化
  • 重庆网站设计定制/国外域名注册
  • 自己的网站是什么样子的/营销网站的宣传、推广与运作
  • 电子商务网站建设阶段/十大骗子教育培训机构
  • 青岛家乐福网上商城/seo在线教学
  • 做网站需要多少/网站seo百度百科
  • html5做图书馆网站/软件开发外包公司
  • 免费推广seo策略方法/seo外包如何
  • 服装logo创意设计/网址seo关键词
  • 有哪些网站可以做海报/厦门百度推广怎么做
  • 专业房地产网站建设/免费海报模板网站
  • 建一个公司需要多少钱?/seo优化技术
  • 设计了网站/怎么做网站?
  • 新疆做网站的公司有哪些/好网站
  • 哪个网站做长图免费转高清图片/东莞seo托管
  • 网站怎么做筛选/高端网站建设制作
  • 关键词网站建设推广/seo排名软件有用吗
  • 织梦后台怎么做导航栏的网站首页/杭州百度公司在哪里
  • 自己找网站开发项目/百度用户服务中心人工24小时电话
  • 上海网站开发/怎么收录网站
  • 学习设计模式《十八》——备忘录模式
  • Jmeter 性能测试响应时间过长怎么办?
  • 自动化测试工具 Selenium 入门指南
  • Linux 驱动中 Timer / Tasklet / Workqueue 的作用与对比
  • YAML 自动化用例中 GET vs POST 请求的参数写法差异
  • 三十二、【核心功能改造】数据驱动:重构仪表盘与关键指标可视化