QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#762027#2510. Make NumbersSanguineChameleon#AC ✓24ms10596kbPython3403b2024-11-19 12:41:592024-11-19 12:42:00

Judging History

你现在查看的是最新测评结果

  • [2024-11-19 12:42:00]
  • 评测
  • 测评结果:AC
  • 用时:24ms
  • 内存:10596kb
  • [2024-11-19 12:41:59]
  • 提交

answer

import itertools
a = input().split()

s = set()
for p in itertools.permutations(a):
    for h in range(1, 64):
        expr = p[0]
        c = h
        for i in range(3):
            d = c % 4
            if d > 0:
                expr += "+-*"[d - 1]
            c //= 4
            expr += p[i + 1]
        res = eval(expr)
        if res >= 0:
            s.add(res)

print(len(s))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 19ms
memory: 10404kb

input:

1 1 1 1

output:

15

result:

ok single line: '15'

Test #2:

score: 0
Accepted
time: 23ms
memory: 10484kb

input:

1 1 1 1

output:

15

result:

ok single line: '15'

Test #3:

score: 0
Accepted
time: 23ms
memory: 10464kb

input:

1 1 2 1

output:

32

result:

ok single line: '32'

Test #4:

score: 0
Accepted
time: 23ms
memory: 10456kb

input:

1 2 4 8

output:

178

result:

ok single line: '178'

Test #5:

score: 0
Accepted
time: 23ms
memory: 10596kb

input:

1 3 3 8

output:

107

result:

ok single line: '107'

Test #6:

score: 0
Accepted
time: 23ms
memory: 10576kb

input:

1 1 2 1

output:

32

result:

ok single line: '32'

Test #7:

score: 0
Accepted
time: 23ms
memory: 10464kb

input:

2 2 4 4

output:

58

result:

ok single line: '58'

Test #8:

score: 0
Accepted
time: 23ms
memory: 10464kb

input:

2 3 4 5

output:

183

result:

ok single line: '183'

Test #9:

score: 0
Accepted
time: 17ms
memory: 10504kb

input:

2 3 5 7

output:

191

result:

ok single line: '191'

Test #10:

score: 0
Accepted
time: 19ms
memory: 10504kb

input:

2 4 6 8

output:

172

result:

ok single line: '172'

Test #11:

score: 0
Accepted
time: 24ms
memory: 10580kb

input:

2 5 5 5

output:

54

result:

ok single line: '54'

Test #12:

score: 0
Accepted
time: 17ms
memory: 10524kb

input:

2 8 6 4

output:

172

result:

ok single line: '172'

Test #13:

score: 0
Accepted
time: 23ms
memory: 10584kb

input:

3 3 3 3

output:

22

result:

ok single line: '22'

Test #14:

score: 0
Accepted
time: 23ms
memory: 10508kb

input:

5 3 2 7

output:

191

result:

ok single line: '191'

Test #15:

score: 0
Accepted
time: 18ms
memory: 10484kb

input:

5 7 8 9

output:

217

result:

ok single line: '217'

Test #16:

score: 0
Accepted
time: 21ms
memory: 10500kb

input:

9 9 9 9

output:

20

result:

ok single line: '20'