QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#559484#5130. Failing Flagshipjoshua_125AC ✓16ms10648kbPython31015b2024-09-11 22:23:072024-09-11 22:23:07

Judging History

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

  • [2024-09-11 22:23:07]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:10648kb
  • [2024-09-11 22:23:07]
  • 提交

answer

def string_to_angle(angle_string):
    directions = {"N": 0, "E": 1/4, "S": 2/4, "W": 3/4}

    if len(angle_string) == 1:
        return directions[angle_string]

    angle_string = angle_string[::-1]
    first_char, second_char = angle_string[:2]
    other_chars = angle_string[2:]

    first_dir, second_dir = directions[first_char], directions[second_char]

    if set([first_dir, second_dir]) == set([0,0.75]):
        directions["N"] = 1
        first_dir, second_dir = directions[first_char], directions[second_char]

    angle = (first_dir + second_dir) / 2
    angle_delta = 1/16

    up_dir = max([first_dir, second_dir])

    for char in other_chars:
        this_dir = directions[char]
        if this_dir == up_dir:
            angle += angle_delta
        else:
            angle -= angle_delta

        angle_delta /= 2

    return angle


x, y = input().split()
ax, ay = string_to_angle(x) * 360, string_to_angle(y) * 360
diff = abs(ax - ay)

if diff > 180:
    diff = 360 - diff

print(diff)







詳細信息

Test #1:

score: 100
Accepted
time: 7ms
memory: 10484kb

input:

N S

output:

180.0

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #2:

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

input:

NNE SSSE

output:

146.25

result:

ok found '146.2500000', expected '146.2500000', error '0.0000000'

Test #3:

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

input:

ENE NW

output:

112.5

result:

ok found '112.5000000', expected '112.5000000', error '0.0000000'

Test #4:

score: 0
Accepted
time: 5ms
memory: 10492kb

input:

SW SE

output:

90.0

result:

ok found '90.0000000', expected '90.0000000', error '0.0000000'

Test #5:

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

input:

NENE SESSE

output:

95.625

result:

ok found '95.6250000', expected '95.6250000', error '0.0000000'

Test #6:

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

input:

NWWNNWNWNW E

output:

148.53515625

result:

ok found '148.5351562', expected '148.5351562', error '0.0000000'

Test #7:

score: 0
Accepted
time: 8ms
memory: 10608kb

input:

SWWWSWSSSSW NNNNNNNNNNNW

output:

171.7822265625

result:

ok found '171.7822266', expected '171.7822266', error '0.0000000'

Test #8:

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

input:

N N

output:

0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #9:

score: 0
Accepted
time: 16ms
memory: 10396kb

input:

S N

output:

180.0

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #10:

score: 0
Accepted
time: 10ms
memory: 10472kb

input:

NW SE

output:

180.0

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #11:

score: 0
Accepted
time: 7ms
memory: 10444kb

input:

SE SESE

output:

11.25

result:

ok found '11.2500000', expected '11.2500000', error '0.0000000'

Test #12:

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

input:

SE SSESE

output:

5.625

result:

ok found '5.6250000', expected '5.6250000', error '0.0000000'

Test #13:

score: 0
Accepted
time: 15ms
memory: 10492kb

input:

EEENE ENENE

output:

22.5

result:

ok found '22.5000000', expected '22.5000000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 15ms
memory: 10612kb

input:

NW NNWWNNNNWNWNNNNNNNNNWNNNWNWNWWNWNWNWNWNWWNNNNNNNNNNNWNWNWWWNWNNWNWWWWWWNWWWNNNWNNWNNNNNNNWWWWWNNNNNNWNWWWNNWNWNWNNNNNNWWNWWWNNNNWNNWWNNNNWWWWNWNNWWWNNWWWNNNWNNWWWWWWWNNWWWWWNWNNNNWWWNWWNNNWNWNWNNNNWNNWWWNWNNNNWWWWNNNWWNWNWNWNNNWNWNNWNWNWNNNNNNWNNNWWNNNNNWNWWWNWWNWNWWWWWNWNNWWWNNWNWNNWNWWWWWWWNNWW...

output:

3.147502463404237

result:

ok found '3.1475025', expected '3.1475025', error '0.0000000'

Test #15:

score: 0
Accepted
time: 10ms
memory: 10476kb

input:

WNWWNWNWNNNWNWWWWNNNWWNWNWWNNWNNWWWNWNNWWWWWWWWWNWWNWNNWWNWNNNWWNNNNNNNWWWWNWWNWWNWWWNNWNWNWNNNNNNWNWWNNNWNWWWNNNNWWNWNWWWWWNWWWNWWWWWNNWNNWWNWWWWNNWNWNNWNNNWWNNNWWWWWNNWWWWWWNNWWNWNNWWWNNNNWNNNNNNWNNNWNNWNWWWWWWNNNNNWNWNNNWWNNNWNNNNNWWNWNWNWNNWNNNNNWWWNNNNNNWNNWNNNNWWWWNNNWNWWWWWNWWNWWWNNNWWWWWNWWN...

output:

82.26615478105799

result:

ok found '82.2661548', expected '82.2661548', error '0.0000000'

Test #16:

score: 0
Accepted
time: 12ms
memory: 10512kb

input:

NNNENNNNEENNEEENEENNNNENNNENEENEENNNNENENEENNNEENE WNNWWNWWWNNWNNNNWWNWNNWNNNWNNWWNNWWWWWNWNNWWNNWNNWNNNWNWWNWWNNNWNWNNWWWWWWWWWWWWNWWNNWWWNNNNWWWNNWNWNNNNWWNNNWNWNWNNNWWNNWWWNWWNNWNWNNNWNWWNWNNNNNNNNNWWWNWWNWWWNWNWNWNNNWNNNWNNWNWNWWWNNWWWWWWNWNNNNNWNNWWWWNNNNNNWWWNWNWNWNWNWNNWNWWWNNNNWNNWWWNWNWNWWW...

output:

82.77950034115088

result:

ok found '82.7795003', expected '82.7795003', error '0.0000000'

Test #17:

score: 0
Accepted
time: 15ms
memory: 10572kb

input:

WNNWNWWWWNNWWWWNWNNWWNNWWNWNNWNWWWWWNWNWNNWWNNWWNNNNWNNNNWWNWNNNWNWNWNWWWNNWNWWNNWWWNWNWWWNWWNNWWNWNWNNWNWWWWNNWNWNNNNWWNWWWNWNWNWNWNNNNWNWWNNNNNNNWNNWWNNWNWWNNWWNNWWWWWWWNNWNWNWWWNNWWWNWNWWNWNNWWNWNNWNNNNNNNNWWWWNWNNNNWNNWWNNNNWNWWNWWNNWNWNNWNNNNWWNWWNWNNWWWWWNNWNNNNWWWWNNWWWNWWNWWNNWNWNNWNNNNWNWWN...

output:

124.59323666115094

result:

ok found '124.5932367', expected '124.5932367', error '0.0000000'

Test #18:

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

input:

SSSEEEEEESEEEESSESEEEEEEEEESSEEESSESSESSSESSSESEEEEESSSSEESSSSSEESSSESESEEESEESEEEEEEESSSSESSESSESEESEESSESEESESSSSEESSESSESSEESEEEESSESEEEEEEEESEEEESEESEESSESEESEEESEESESEESSEESESESESSESESESSEESSEEESEESESESEEESESSSESEESESSESEESSSESESSESEESSEEEESSSSSSESSEESSSSEESEESESSESSSEESSEEESSSESEEESSSEEEEESEES...

output:

132.99531061899523

result:

ok found '132.9953106', expected '132.9953106', error '0.0000000'

Test #19:

score: 0
Accepted
time: 15ms
memory: 10480kb

input:

WWNWNNNWNWNNWNNNNNWNNWNWNWNWWWWWNWNWNNWWNWWWWNNNWNWWWWWWWWWWWWNNNNNNNWWWWNNNWNWNWWWNNWWNNNNNWWWWWNWWNWWNWNWNNNWNWWNNNNNNWNNNWNNWWNWWWWNNNNNNNWNNWWWWWNNWWWNWWWWWWWNWWNNWWWNNNNNNWNNWNNNNNWNWNNNNWWNNNNNWWNNNNWWNWNNWNWNNNWWWWWWWNWNNNNNWNWWNWWWWWNNNNWNNNNNWWWWWWWWWNWWNWNWNNNWNNWWNNNWWWNWWNNWWWNNNNWWWNNNW...

output:

153.4450521180824

result:

ok found '153.4450521', expected '153.4450521', error '0.0000000'

Test #20:

score: 0
Accepted
time: 11ms
memory: 10572kb

input:

N NNNNNNNNNW

output:

0.17578125

result:

ok found '0.1757812', expected '0.1757812', error '0.0000000'

Test #21:

score: 0
Accepted
time: 7ms
memory: 10648kb

input:

N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNE

output:

4.092726157978177e-11

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #22:

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

input:

S SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSW

output:

8.526512829121202e-14

result:

ok found '0.0000000', expected '0.0000000', error '0.0000000'

Test #23:

score: 0
Accepted
time: 4ms
memory: 10480kb

input:

S SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSE

output:

0.0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #24:

score: 0
Accepted
time: 12ms
memory: 10608kb

input:

N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...

output:

0.0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #25:

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

input:

NE EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...

output:

0.0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #26:

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

input:

E W

output:

180.0

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #27:

score: 0
Accepted
time: 8ms
memory: 10452kb

input:

W E

output:

180.0

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #28:

score: 0
Accepted
time: 4ms
memory: 10492kb

input:

EEEEEEEEEEEEEEEEEEEENE W

output:

179.99995708465576

result:

ok found '179.9999571', expected '179.9999571', error '0.0000000'

Test #29:

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

input:

EEEEEEEEEEEEEEEEEEEESE W

output:

179.99995708465576

result:

ok found '179.9999571', expected '179.9999571', error '0.0000000'

Test #30:

score: 0
Accepted
time: 15ms
memory: 10480kb

input:

EEEEEEEEEEEEEEEEEEEEESE W

output:

179.99997854232788

result:

ok found '179.9999785', expected '179.9999785', error '0.0000000'

Test #31:

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

input:

EEEEEEEEEEEEEEEEEEEEEEEEEEEEEESE W

output:

179.99999995809048

result:

ok found '180.0000000', expected '180.0000000', error '0.0000000'

Test #32:

score: 0
Accepted
time: 15ms
memory: 10572kb

input:

SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSWSW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWSSW

output:

0.0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #33:

score: 0
Accepted
time: 15ms
memory: 10644kb

input:

SSSSSSSSSSSSSSSSSSSSWSW WWWWWWWWWWWWWWWWWWWWSSW

output:

4.291534423828125e-05

result:

ok found '0.0000429', expected '0.0000429', error '0.0000000'

Test #34:

score: 0
Accepted
time: 7ms
memory: 10572kb

input:

SSSSSSSSSSSSSWWWSSSWSWSWSSSSSWWWWWWSWSWSWSSSWWSSW SSSSSSSSSSSSSWWWSSSWSWSWSSSSSWWWWWWSWSWSWSSSWWSSW

output:

0.0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'