20 lines
474 B
Python
20 lines
474 B
Python
import re
|
|
import sys
|
|
|
|
|
|
def isPow2Hex(s):
|
|
pattern = re.compile(r'^(?:[1-9A-Fa-f]0*|0)$')
|
|
return bool(re.match(pattern, s))
|
|
|
|
# inFile = sys.argv[1]
|
|
# outFile = sys.argv[2]
|
|
|
|
inFile = 'test.in'
|
|
outFile = 'test.out'
|
|
|
|
with open(inFile, 'r', encoding='utf-8') as inputFile, open(outFile, 'w', encoding='utf-8') as outputFile:
|
|
for line in inputFile:
|
|
line = line.strip()
|
|
result = "yes" if isPow2Hex(line) else "no"
|
|
outputFile.write(result + '\n')
|