0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

制限標準出力問題

Last updated at Posted at 2020-02-15

  • 文字列・数値リテラル不可
  • chr/ord関数不可

似たようなネタの問題をCodeIQで出題したことがありましたが、あっちはchr関数の利用が前提だったので、もう一捻りがなかなか大変でした(chrが使えないとgetattrすらままならない)。
かろうじてbytearray.decodeで事なきを得ました。

※Py2/3両方可です

Sh1ma.py
#!/usr/bin/env python
szero = len(str(len([])))
sone = szero + szero
stwo = sone + sone
sthree = stwo + stwo
sfour = sthree + sthree
sfive = sfour + sfour
ssix = sfive + sfive
print(bytearray([
	ssix+sfour+sone+szero,
	ssix+sfive+sthree,
	sfive+sfour+szero,
	ssix+sfive+sthree+stwo+szero,
	ssix+sfive+szero,
]).decode())
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?