Skip to content

Instantly share code, notes, and snippets.

@lrlucena
Created May 23, 2019 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrlucena/18496936e7a5a5820e8bdc292e4732ca to your computer and use it in GitHub Desktop.
Save lrlucena/18496936e7a5a5820e8bdc292e4732ca to your computer and use it in GitHub Desktop.
zero = BigInt(0)
var entrada = leia_texto
enquanto entrada <> None.orNull faça
n = BigInt(entrada)
var pos = 0
enquanto zero.setBit(pos) < n faça
pos := pos + 1
fim
head = zero.setBit(pos)
escreva "{n} {se head==n então "true {pos}" senão "false" fim}"
entrada := leia_texto
fim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment