kzyz

30.8万

subtractionpainter
Isaacs
AC-king

zhanghonghe2

Aibneclass
lts_

0error0
LeRoi

kzyz
9天前
def dfs(u):
if u == n:
print(" ".join(map(str, g)))
return

for i in range(n):
if not st[i]:
st[i] = True
g[u] = i + 1
dfs(u + 1)
st[i] = False

if __name__ == "__main__":
n = int(input())
st = [False] * n
g = [0] * n
dfs(0)


kzyz
9天前
if __name__ == "__main__":
n, m = map(int, input().split())

res = [[0] * m for _ in range(n)]
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]:
d = (d + 1) % 4
a, b = x + dx[d], y + dy[d]
x, y = a, b

for i in range(n):
print(" ".join(map(str, res[i])))


kzyz
9天前
if __name__ == "__main__":
t = input()
s, c = 0, 0

for i in range(12):
d = list(map(float, input().split(' ')))
for j in range(12):
if j > i:
s += d[j]
c += 1

if t == "M":
s /= c

print("%.1f" % s)


kzyz
9天前
import math

if __name__ == "__main__":
n = int(input())
for _ in range(n):
x = int(input())
for i in range(2, int(math.sqrt(x)) + 1):
if x % i == 0:
print("%d is not prime" % x)
break
else:
print("%d is prime" % x)


kzyz
9天前
if __name__ == "__main__":
while True:
n = int(input())
if n == 0:
break
print(" ".join(map(str, list(range(1, n + 1)))))


kzyz
9天前
if __name__ == "__main__":
print(len(input()))


kzyz
9天前
if __name__ == "__main__":
x, y = map(int, input().split())
p = [4, 4.5, 5, 2, 1.5]
print("Total: R\$ %.2f" % (p[x - 1] * y))


kzyz
9天前
if __name__ == "__main__":
a = input()
b = input()
c = input()

if b == "ave":
if c == "carnivoro":
print("aguia")
else:
print("pomba")
else:
if c == "onivoro":
print("homem")
else:
print("vaca")
else:
if b == "inseto":
if c == "hematofago":
print("pulga")
else:
print("lagarta")
else:
if c == "hematofago":
print("sanguessuga")
else:
print("minhoca")


kzyz
9天前
if __name__ == "__main__":
a, b = map(int, input().split())
if a % b == 0 or b % a == 0:
print("Sao Multiplos")
else:
print("Nao sao Multiplos")


kzyz
9天前
if __name__ == "__main__":
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print("DIFERENCA = %d" % (a * b - c * d))