print(sum(map(int, input().split())))
str = input()
for i in range(3):
print(" "*(2-i)+str*(2*i+1))
def mul(a):
return a[0] * a[1]
print(mul(list(map(int, input().split()))))
print(input().upper())
居然需要转成浮点数。
print(float(input()[::-1]),end="")
a, b = map(float, input().split())
print("%.3f" % (a/b))
print("%.0f" % (b * 2))
from math import sqrt
a, b, c = map(float, input().split())
p = 0.5 * (a + b + c)
s = sqrt(p*(p-a)*(p-b)*(p-c))
print("%.1f" % s)
from math import ceil
s, v = map(int, input().split())
t = ceil(s/v)
t += 10
t0 = (8 * 60 - t + 24 * 60) % (24 * 60)
h = t0 // 60
m = t0 - h * 60
if h < 10:
h = "0" + str(h)
if m < 10:
m = "0" + str(m)
print(str(h)+":"+str(m))
from math import ceil
h, r = map(int, input().split())
h, r = h/10, r/10
pi = 3.14
v = h * pi * r * r
print(ceil(20/v))
a, b, c, d = map(int, input().split())
start = a * 60 + b
end = c * 60 + d
h = (end - start) // 60
m = end - start - h * 60
print(h, m)
a, b = map(int, input().split())
money = a * 10 + b
price = 1 * 10 + 9
print(money // price)
a, b, c = map(int, input().split())
print(int(a * 0.2 + b * 0.3 + c * 0.5))
import math
n=int(input())
if n==1:
print('I love Luogu!')
elif n==2:
print(2+4,10-2-4)
elif n==3:
print(14//4)
print(14-14%4)
print(14%4)
elif n==4:
print("%.3f"%(500/3))
elif n==5:
print((260+220)//(12+20))
elif n==6:
print("%.4f"%(math.sqrt(6**2+9**2)))
elif n==7:
print(100+10)
print(100+10-20)
print(0)
elif n==8:
pi=3.141593
r=5
print("%.4f"%(2*pi*r))
print("%.4f"%(pi*r*r))
print("%.3f"%((4*pi*(r**3))/3))
elif n==9:
day4=1
day3=(day4+1)*2
day2=(day3+1)*2
day1=(day2+1)*2
print(day1)
elif n==10:
y=(8*30-10*6)/24
x=10*6-y*6
print(int((x+y*10)/10))
elif n==11:
print("%.4f"%(100/(8-5)))
elif n==12:
print(ord('M')-64)
print(chr(64+18))
elif n==13:
pi=3.141593
print(int(pow((4*pi*(4**3+10**3))/3,1/3)))
elif n==14:
money=1
price=110
num=10
x=[]
while money!=0:
money=price*num
if money==3500:
x.append(price)
price-=1
num+=1
mprice=min(x)
print(mprice)
from math import ceil
m, t, s = map(int, input().split())
if t == 0:
print("0")
else:
leave = m - ceil(s/t) if m >= ceil(s/t) else 0
print(leave)
n = int(input())
sum = 0
if n % 2 == 0:
sum += 1
if 4 < n <= 12:
sum += 1
a = 1 if sum == 2 else 0
b = 1 if sum > 0 else 0
c = 1 if sum == 1 else 0
d = 1 if sum == 0 else 0
print(a, b, c, d)
year = int(input())
if (year % 400 == 0) or ((year % 4 == 0) and (year % 100 != 0)):
print(1)
else:
print(0)
n = int(input())
if n > 2:
print("Today, I ate %d apples." % n)
else:
print("Today, I ate %d apple." % n)
n = int(input())
local = n * 5
luogu = n * 3 + 11
if luogu > local:
print("Local")
else:
print("Luogu")
m, h = map(float, input().split())
bmi = m / (h * h)
if bmi < 18.5:
print("Underweight")
elif bmi < 24:
print("Normal")
else:
print("%.6g" % bmi)
print("Overweight")
l = list(map(int, input().split()))
l.sort()
for i in l:
print(i, end=' ')
y, m = map(int, input().split())
if (y % 400 == 0) or ((y % 4 == 0) and (y % 100 != 0)):
y1 = 1
else:
y1 = 0
m31 = [1, 3, 5, 7, 8, 10, 12]
m30 = [4, 6, 9, 11]
if m in m31:
print(31)
elif m in m30:
print(30)
elif m == 2:
if y1 == 0:
print(28)
else:
print(29)
m = []
for i in range(7):
s = sum(map(int, input().split()))
n = s - 8 if s > 8 else 0
m.append(n)
if sum(m) == 0:
print(0)
else:
print(m.index(max(m))+1)
from math import ceil
n = int(input())
Min = 1e7
for i in range(3):
nums, price = map(int, input().split())
k = ceil(n/nums)
Min = min(Min, k * price)
print(Min)
a, b, c = map(int, input().split())
if a > b: a, b = b, a
if a > c: a, c = c, a
if b > c: b, c = c, b
if a + b <= c:
print("Not triangle")
else:
if a**2 + b**2 == c**2:
print("Right triangle")
if a**2 + b**2 > c**2:
print("Acute triangle")
if a**2 + b**2 < c**2:
print("Obtuse triangle")
if a == b or a == c or b == c:
print("Isosceles triangle")
if a == b and a == c and b == c:
print("Equilateral triangle")
n = int(input())
p = 0
if n <= 150:
p = n * 0.4463
elif 150 < n <= 400:
p = 150 * 0.4463 + (n - 150) * 0.4663
else:
p = 150 * 0.4463 + 250 * 0.4663 + (n - 400) * 0.5663
print("%.1f"%p)
x, n = map(int, input().split())
s = 0
for i in range(n):
if x == 7:
x = 1
elif x == 6:
x += 1
else:
s += 250
x += 1
print(s)
from math import gcd
l = list(map(int, input().split()))
a = gcd(min(l), max(l))
print("%d/%d"%(min(l)/a, max(l)/a))
a = list(map(int, input().split()))
h = int(input()) + 30
n = 0
for i in a:
if i <= h:
n += 1
print(n)
a = list(map(int,input().split()))
s = list(input())
a.sort()
for i in range(3):
if ord(s[i]) - 64 == 3:
print(a[2], end=" ")
elif ord(s[i]) - 64 == 1:
print(a[0], end=" ")
else:
print(a[1], end=" ")
a = input()
n = list(a.split("-"))
s = ""
for i in range(len(n) - 1):
s += n[i]
i, num = 1, 0
for j in s:
num += int(j) * i
i += 1
num = num % 11 if num % 11 != 10 else 'X'
if str(num) == str(n[-1]):
print("Right")
else:
print(a[:-1]+str(num))
n = input()
a = list(map(int, input().split()))
print(min(a))
n, k = map(int, input().split())
a = []
b = []
for i in range(1, n + 1):
if i % k == 0:
a.append(i)
else:
b.append(i)
print("%.1f" % (sum(a)/len(a)), "%.1f" % (sum(b)/len(b)))
n = int(input())
ret = 0
while n >= 1:
n //= 2
ret += 1
print(ret)
n = int(input())
k = 1
for i in range(n):
for j in range(i, n):
if k < 10:
print("0%d" % k, end="")
else:
print("%d" % k, end="")
k += 1
print("")
def kk(a):
res = 1
for i in range(1, a + 1):
res *= i
return res
n = int(input())
s = 0
for i in range(1, n + 1):
s += kk(i)
print(s)
n, x = map(int, input().split())
s = ""
for i in range(1, n + 1):
s += str(i)
print(s.count(str(x)))
k = int(input())
s = 0
n = 1
while s <= k:
s += 1/n
n += 1
print(n-1)
n = int(input())
s, m = 0, 0
for i in range(1, n + 1):
if n <= s:
break
m += i * i
s += i
if s > n:
m -= (i - 1) * (s-n)
print(m)
n = int(input())
s = [_ for _ in range(1, n + 1)]
print(sum(s))
from math import sqrt
def pri(k):
for i in range(2, int(sqrt(k)) + 1):
if k % i == 0:
return False
return True
L = int(input())
ret, sum = 0, 0
for i in range(2, 100000):
if pri(i):
sum += i
if sum <= L:
print(i)
ret += 1
else:
break
print(ret)
TLE
from math import sqrt
def pri(k):
for i in range(2, int(sqrt(k)) + 1):
if k % i == 0:
return False
return True
a, b = map(int, input().split())
for i in range(a, b + 1):
if pri(i):
if str(i) == str(i)[::-1]:
print(i)
n = float(input())
s, v, ret = 0, 2, 0
while s < n:
s += v
v *= 0.98
ret += 1
print(ret)
n = input()
s = ""
if int(n) > 0:
n = list(n)
n.reverse()
while n[0] == '0':
n.pop(0)
for i in n:
s += str(i)
print(s)
elif int(n) == 0:
print("0")
else:
n = list(n)
n.pop(0)
n.reverse()
while n[0] == '0':
n.pop(0)
for i in n:
s += str(i)
print("-"+s)
a, b = 1, 1
n = int(input())
if n == 0:
print("0.00")
else:
if n == 1 or n == 2:
print("%.2f" % a)
for i in range(2, n):
a, b = b, a + b
print("%.2f" % b)
n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))
n = int(input())
a = list(map(int, input().split()))
ret = 1
m = 1
for i in range(1, n):
if a[i] == a[i-1] + 1:
ret += 1
m = max(m, ret)
else:
ret = 1
print(m)
n = int(input())
if n == 1:
print("1")
else:
for i in range(2, n + 1):
if n % i == 0:
print(int(n/i))
break
n = int(input())
k = 1
for i in range(n):
for j in range(n):
if k < 10:
print("0%d" % k, end="")
else:
print("%d" % k, end="")
k += 1
print("")
print("")
k = 1
for i in range(n):
print(" " * (n - i - 1) * 2, end="")
for j in range(n - i - 1, n):
if k < 10:
print("0%d" % k, end="")
else:
print("%d" % k, end="")
k += 1
print("")
n = int(input())
a = list(map(int, input().split()))
a.pop(a.index(max(a)))
a.pop(a.index(min(a)))
print("%.2f" % (sum(a)/len(a)))
n = int(input())
for x in range(100, 0, -1):
if (n/364 -x)%3 == 0 and (n/364 -x)/3 > 0:
print(x)
print("%.0f" % ((n/364 -x)/3))
break
m = 0
mo = 0
flag = True
for i in range(12):
a = int(input())
m += 300
m -= a
if m >= 100:
k = int(str(m)[0]) * 100
mo += k
m -= k
if m < 0:
print("-%d" % (i + 1))
flag = False
break
if flag:
print("%.0f" % (mo*1.20+20))
budgets = [int(input()) for _ in range(12)]
start = saving = 0
for i in range(12):
start += 300 - budgets[i]
if start < 0:
print(0-i-1)
break
else:
saving += start//100
start %= 100
else:
print(saving*120+start)
290 230 280 200 300 170 330 50 90 80 200 60
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
ret = 0
for j in range(i):
if a[j] < a[i]:
ret += 1
b.append(ret)
for i in b:
print(i, end=" ")
a = list(map(int, input().split()))
for i in range(len(a) - 2, -1, -1):
print(a[i], end=" ")
n = int(input())
a = []
while n != 1:
a.append(n)
if n % 2 == 1:
n = n * 3 + 1
else:
n = n / 2
a.append(1)
for i in range(len(a) - 1, -1, -1):
print("%.0f" % a[i], end=" ")
n, m = map(int, input().split())
a = [1 for _ in range(n+1)]
for i in range(m):
u, v = map(int, input().split())
for j in range(u, v + 1):
a[j] = 0
print(sum(a))
n = int(input())
s = []
ret = 0
for i in range(n):
a, b, c = map(int, input().split())
s.append([a, b, c])
for i in range(n):
for j in range(i + 1, n):
if abs(s[i][0] - s[j][0]) <= 5 and abs(s[i][1] - s[j][1]) <= 5 and abs(s[i][2] - s[j][2]) <= 5 and abs(
sum(s[i]) - sum(s[j])) <= 10:
ret += 1
print(ret)
w, x, h = map(int, input().split())
s = [[[1 for i in range(h)] for j in range(x)] for k in range(w)]
for _ in range(int(input())):
x1, y1, z1, x2, y2, z2 = map(int, input().split())
for i in range(x1-1, x2):
for j in range(y1-1, y2):
for k in range(z1-1, z2):
s[i][j][k] = 0
ret = 0
for i in range(w):
for j in range(x):
ret += sum(s[i][j])
print(ret)
n = int(input())
y = list(map(int, input().split()))
res = [0 for _ in range(8)]
def kk(t):
global res
res[7-t] += 1
for i in range(n):
ret = 0
g = list(map(int, input().split()))
for j in g:
if j in y:
ret += 1
kk(ret)
for i in range(7):
print(res[i], end=" ")
头晕,copy一个。
n=int(input())
m=n//2
ls=[[0 for i in range(n)] for i in range(n)]
def hanshu(ls,n,m):
ls[0][m]=str(1)
x,y=2,pow(n,2)
a,b=0,m
while x<=y:
if a==0 and b!=n-1:
ls[n-1][b+1]=str(x)
a,b=n-1,b+1
elif b==n-1 and a!=0:
ls[a-1][0]=str(x)
a,b=a-1,0
elif a==0 and b==n-1:
ls[a+1][b]=str(x)
a,b=a+1,b
else:
if ls[a-1][b+1]==0:
ls[a-1][b+1]=str(x)
a,b=a-1,b+1
else:
ls[a+1][b]=str(x)
a,b=a+1,b
x+=1
for i in ls:
print(" ".join(i))
hanshu(ls,n,m)
头大。。。
a, b = map(int, input().split())
s = ""
for i in range(a, b + 1):
s += str(i)
for i in range(10):
print(s.count(str(i)), end=" ")
n = int(input())
a = list(map(int, input().split()))
k = []
for i in range(n):
for j in range(i + 1, n):
k.append(a[i]+a[j])
ret = 0
for i in a:
if i in k:
ret += 1
print(ret)
n, m = map(int, input().split())
a = []
for i in range(n):
a.append(int(input()))
k = 40010
for i in range(n-m):
ret = 0
for j in range(i, i + m):
ret += a[j]
k = min(k, ret)
if n == m:
k = sum(a)
print(k)
flag = [0] * 100010
s1, s2, s3 = map(int, input().split())
for i in range(1, s1 + 1):
for j in range(1, s2 + 1):
for k in range(1, s3 + 1):
flag[i+j+k] += 1
ans = -1
res = 0
tmp = 0
for i in range(1, s1*s2*s3 + 1):
res = flag[i]
if res > ans:
ans = res
tmp = i
print(tmp)
T = [0] * 2000000
for i in range(int(input())):
a, t = map(float, input().split())
t = int(t)
for j in range(1, t + 1):
T[int(a * j)] = (T[int(a * j)]+1) % 2
print(T.index(1))
n,m = map(int,input().split())
res = [[0 for i in range(m)] for i in range(n)]
# 需要时刻明白的是 x代表的是行号,y代表的是列号
# dx,dy表示的是上右下左的四个方向
# 往上走行号-1,列号不变
# 往右走行号不变,列号+1
dx, dy = [-1, 0, 1, 0], [0, 1, 0, -1]
# 最开始x,y是从0开始,也就是左上角的第一个
# d为1默认的首先的顺序是从往右开始的
x , y, d = 0, 0, 1
# 跟题目要求 i是从1开始的到n*m
for i in range(1, n * m + 1):
res[x][y] = i
a, b = x + dx[d], y + dy[d]
# 当a,b到了边界之后或者此时res[a,b]不为0 就需要换方向了
# 这个时候需要改变的就是d了
if a < 0 or a >= n or b < 0 or b >= m or res[a][b] != 0:
d = (d + 1) % 4
a, b = x + dx[d], y + dy[d];
x, y = a, b
for i in range(n):
for j in range(m):
print(res[i][j], end=' ')
print()
n = int(input())
m = n
res = [[0 for i in range(m+1)] for j in range(n+1)]
dx, dy = [-1, 0, 1, 0], [0, 1, 0, -1]
x, y, d = 0, 0, 1
for i in range(1, n * m + 1):
res[x][y] = i
a, b = x + dx[d], y + dy[d]
if a < 0 or a >= n or b < 0 or b >= m or res[a][b] != 0:
d = (d + 1) % 4
a, b = x + dx[d], y + dy[d]
x, y = a, b
for i in range(n):
for j in range(m):
print("%3d" % res[i][j], end="")
print()
n = eval(input())
triangle = []
for i in range(n):
cur = [1]
triangle.append(cur) #先追加进去
if i == 0:
continue
pre = triangle[i-1]
for j in range(i-1):
cur.append(pre[j] + pre[j+1])
cur.append(1)
for i in range(n):
for j in range(i+1):
print(triangle[i][j], end=" ")
print("")
n, m, k = map(eval, input().split())
matrix = [[0 for j in range(n)] for i in range(n)]
def Huoba(x, y):
for i in range(x - 2, x + 3):
if i < 0 or i > n - 1:
continue
matrix[i][y] = 1
for i in range(y - 2, y + 3):
if i < 0 or i > n - 1:
continue
matrix[x][i] = 1
for i in range(x - 1, x + 2):
for j in range(y - 1, y + 2):
if i < 0 or i > n - 1 or j < 0 or j > n - 1:
continue
matrix[i][j] = 1
def Yingshi(x, y):
for i in range(x - 2, x + 3):
for j in range(y - 2, y + 3):
if i < 0 or i > n - 1 or j < 0 or j > n - 1:
continue
matrix[i][j] = 1
for i in range(m):
x, y = map(eval, input().split())
Huoba(x - 1, y - 1)
for i in range(k):
x, y = map(eval, input().split())
Yingshi(x - 1, y - 1)
s = 0
for i in range(n):
s += sum(matrix[i])
print(n*n - s)
a = list(map(int, input().split()))
flag = 0
ret = 0
n = a.pop(0)
for i in a:
for j in range(i):
ret += 1
print(flag, end="")
if ret == n:
ret = 0
print("")
flag = (flag + 1) % 2
ss=input().strip()
n=len(ss)
for i in range(n-1):
ss+=input().strip()
l=[n,0]
d=0
if ss[0]=='1':
l.append(0)
for i in range(1,len(ss)):
if ss[i]!=ss[i-1]:
l.append(i-d)
d=i
l.append(len(ss)-d)
l.pop(1)
print(" ".join(str(i) for i in l))
n = input()
print(n.upper())
n = int(input())
s = input()
ret = ord('z') - ord('a') + 1
for i in s:
if ord(i)+n <= ord('z'):
print(chr(ord(i)+n), end="")
else:
print(chr(ord(i)+n-ret), end="")
import collections, math
s = input()
a = collections.Counter(s)
n = a.most_common(1)[0][1] - 1
flag = 1
print(a)
if n == 0 or n == 1 or n < 0:
flag = 0
n = 0
for i in range(2, int(math.sqrt(n))+1):
if n % i == 0:
flag = 0
break
if flag:
print("Lucky Word")
print(n)
else:
print("No Answer")
print(0)
m = ['a', 'b', 'c']
flag = ""
for i in range(int(input())):
s = list(input().split())
if s[0] in m:
if s[0] == 'a':
flag = '+'
elif s[0] == 'b':
flag = '-'
else:
flag = '*'
print("%s%s%s=%d" % (s[1], flag, s[2], eval("%s%s%s" % (s[1], flag, s[2]))))
print(len("%s%s%s=%d" % (s[1], flag, s[2], eval("%s%s%s" % (s[1], flag, s[2])))))
else:
print("%s%s%s=%d" % (s[0], flag, s[1], eval("%s%s%s" % (s[0], flag, s[1]))))
print(len("%s%s%s=%d" % (s[0], flag, s[1], eval("%s%s%s" % (s[0], flag, s[1])))))
import re
s = input()
str1 = re.sub(' ', '\n', s)
print(len(str1))
三WA
n = int(input())
s = input()
for i in range(n):
op = list(input().split())
if op[0] == '1':
s = s+op[1]
print(s)
elif op[0] == '2':
s = s[int(op[1]):int(op[1]+op[2])]
print(s)
elif op[0] == '3':
s = s[:int(op[1])] + op[2] + s[int(op[1]):]
print(s)
elif op[0] == '4':
print(s.find(op[1]))
def count_words(key, article):
key = ' ' + key.upper() + ' '
article = ' ' + article.upper() + ' ' # 在开头和结尾补齐一个空格,使第一个单词和最后一个单词与其他位置的单词保持一致
if key in article:
print(article.count(key), article.find(key))
else:
print("-1")
key = input()
article = input()
count_words(key, article)
好多题目都不会了。。