I/O输入输出

 

#输入一个字符串分割并转化成n个int数值
a, b= map(int, input().strip().split())
#如果无固定个字符串
try:
  while True:
    a, b= map(int, input().strip().split())
    print(a+b)
except:
    break
#输入一个数值转化为int
#如果接下来输入t个数值
t =int(input().strip())
t =int(input().strip())
while t > 0:
    a,b=map(int,input().strip().split())
    print(a+b)
    t=t-1
#if判断,遇见什么什么结束
while True:
    a, b= map(int, input().strip().split())
    if a==0 and b==0 :
        break
    print(a+b)

---------------------------------------------

#获取最大值

import sys
i = sys.maxsize

----------------------------------------------

#类函数排序重写

def cmp(self,other):
    if self.w <other.w:
        return 1
    elif self.w == other.w:
        return 0
    else:
        return -1

import functools

class Strick():
    def __init__(self,l,w):
        self.l = l
        self.w = w
        
sorted(li,key = functools.cmp_to_key(cmp))

 

相关文章:

  • 2022-12-23
  • 2021-10-06
  • 2021-10-03
  • 2022-12-23
  • 2021-12-19
  • 2021-08-29
  • 2022-01-10
  • 2022-01-09
猜你喜欢
  • 2021-06-07
  • 2021-07-07
  • 2022-01-11
  • 2021-12-28
  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
相关资源
相似解决方案