QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#622689 | #8841. North North West | maspy | AC ✓ | 24ms | 11704kb | Python3 | 272b | 2024-10-09 00:08:05 | 2024-10-09 00:08:05 |
Judging History
answer
from fractions import Fraction
while 1:
S=input()
if S=='#':
break
S=S.replace('north','n').replace('west','w')
d=Fraction(90,1)
for i,s in enumerate(S[::-1]):
if not i:
x=90if s=='n'else 0
x+=-d if s=='n' else d
d/=2
print(x)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 24ms
memory: 11704kb
input:
north west northwest northnorthwest westwestwestnorth #
output:
0 90 45 45/2 315/4
result:
ok 5 tokens
Test #2:
score: 0
Accepted
time: 24ms
memory: 11704kb
input:
north west northwest northnorthwest westwestwestnorth westnorth westwestwestnorthwest west northwest northnorthnorthwestnorth northwestnorthwest westwestwestnorth northwestnorth north westnorth westnorthwestnorthwestwestnorthwestwestnorth northnorthwestnorthwestwestwestnorthnorthnorthwestwestnorthno...
output:
0 90 45 45/2 315/4 45 675/8 90 45 45/8 225/4 315/4 45/2 0 45 16335/256 286965/16384 1188585/16384 70065/1024 59985/2048 45/128 4005/64 5085/256 34785/1024 585/32 45/4096 765/64 225/32 974925/65536 2386665/32768 771075/131072 90 3778065/65536 20745/256 92115/1024 2835/32
result:
ok 36 tokens