头像

Daowuu




离线:4小时前


最近来访(7)
用户头像
Pz.Climb
用户头像
Hangya


Daowuu
6天前



Daowuu
7天前


活动打卡代码 AcWing 823. 排列

Daowuu
7天前
n, = map(int, input().split())

arr = [0 for i in range(n+1)]
vis = [0 for i in range(n+1)]

def dfs(cur):
    if cur > n:
        for i in range(1, n+1):
            print(arr[i], end=' ')
        print()
        return

    for i in range(1, n+1):
        if vis[i] == True:
            continue
        vis[i] = True
        arr[cur] = i
        dfs(cur+1)
        vis[i] = False

dfs(1)


活动打卡代码 AcWing 756. 蛇形矩阵

Daowuu
7天前
n, m = map(int, input().split())

x1 = 1
x2 = n
y1 = 1
y2 = m

mp = {}
x = 1
y = 1
T = n*m
val = 1

while T >= val:
    for i in range(y1, y2):
        mp[(x,y)] = val
        val = val + 1
        y = y + 1

    if T < val:
        break
    mp[(x, y)] = val
    val = val + 1
    x = x + 1
    x1 = x1 + 1

    for i in range(x1, x2):
        mp[(x, y)] = val
        val = val + 1
        x = x + 1

    if T < val:
        break
    mp[(x, y)] = val
    val = val + 1
    y = y - 1
    y2 = y2 - 1


    for i in range(y2, y1, -1):
        mp[(x, y)] = val
        val = val + 1
        y = y - 1
    if T < val:
        break

    mp[(x, y)] = val
    val = val + 1
    x = x - 1
    x2 = x2 - 1

    for i in range(x2, x1, -1):
        mp[(x, y)] = val
        val = val + 1
        x = x - 1
    if T < val:
        break

    mp[(x, y)] = val
    val = val + 1
    y = y + 1
    y1 = y1 + 1

arr = [ [0 for i in range(m)] for j in range(n)]

for (x, y), val in mp.items():
    arr[x-1][y-1] = val

for low in arr:
    for val in low:
        print(val, end = ' ')
    print()



Daowuu
7天前
op = input()

sum = 0
for i in range(12):
    a = list(map(float, input().split()))
    for j in range(i+1, 12):
        sum = sum + a[j]

if op == 'S':
    print("%.1f" % (sum))
else:
    print("%.1f" % (sum/66))


活动打卡代码 AcWing 726. 质数

Daowuu
8天前
a, = map(int, input().split())
while a:
    a = a - 1
    b, = map(int, input().split())
    c = True
    for i in range(2, b):
        if b % i == 0:
            c = False
            break
        if i * i > b:
            break
    if not c:
        print("%d is not prime" % (b))
    else:
        print("%d is prime" % (b))



活动打卡代码 AcWing 721. 递增序列

Daowuu
8天前
while True:
    a = input()
    if a == '0':
        break
    for i in range(int(a)):
        print(i+1, end = ' ')
    print()



活动打卡代码 AcWing 760. 字符串长度

Daowuu
8天前
print("%d" % (len(input())))


活动打卡代码 AcWing 660. 零食

Daowuu
8天前
dict = {
    1:4.00,
    2:4.50,
    3:5.00,
    4:2.00,
    5:1.50
}

x, y= map(int, input().split())

print("Total: R$ %.2f" % (dict[x] * y))


活动打卡代码 AcWing 670. 动物

Daowuu
8天前
a = input()
b = input()
c = input()

if a[0] == 'v':
    if b[0] == 'a':
        if c[0] == 'c':
            print("aguia")
        else:
            print("pomba")
    else:
        if c[0] == 'o':
            print("homem")
        else: 
            print("vaca")
else:
    if b[0] == 'i':
        if c[2] == 'm':
            print("pulga")
        else:
            print("lagarta")
    else:
        if c[0] == 'h':
            print("sanguessuga")
        else:
            print("minhoca")