死鱼
Jump to navigation
Jump to search
死鱼 is designed by PSTF.
Command Table
| CMD | Meaning |
|---|---|
| 增 | Increases the accumulator |
| 减 | Decreases the accumulator |
| 方 | Squares the accumulator |
| 出 | Output the value of accumulator as integer |
Examples
72 101 108 108 111 32 119 111 114 108 100
增增增方减方增增增增增增增增出增增增增增增增增增增增 增增增增增增增增增增增增增增增增增增出增增增增增增增 出出增增增出减减减减减减减减减减减减减减减减减减减减 减减减减减减减减减减减减减减减减减减减减减减减减减减 减减减减减减减减减减减减减减减减减减减减减出减减减减 减减减减减减减减出减减减减减减减减减减减减减减减减减 减减减减方减减出减减减减减减减减出增增增出减减减减减 减出减减减减减减减减出减减减减减减减减减减减减减减减 减减减减减减减减减减减减减减减减减减减减减减减减减减 减减减减减减减减减减减减减减减减减减减减减减减减减减 出
Implementations
Python
c,p,x=input(),0,0
while p<len(c):
if p+1>=len(c) or (c[p] not in '增减方出'):
p+=1
else:
if c[p]=='增':
x+=1
elif c[p]=='减':
x=max(-9223372036854775808,x-1)
elif c[p]=='方':
x=min(x**2,9223372036854775807)
elif c[p]=='出':
print(x)
p+=1