LoginSignup
0
0

More than 5 years have passed since last update.

Atcoder Beginer Contest 051 A問題 解説[Brainf*ck]

Last updated at Posted at 2018-02-25

問題

考察

「1文字入力→出力」×5
「1文字入力→空白を出力」
「1文字入力→出力」×7
「1文字入力→空白を出力」
「1文字入力→出力」×5
でいけるのでは?

コード

今回はワンライナー,嬉しい.

+++[->++++++++++<]>++>,.,.,.,.,.<.>,,.,.,.,.,.,.,.<.>,,.,.,.,.,.

解説

pn(n≧0) は先頭からnポインタ目のポインタを,*pnはその値を指す.

+++[->++++++++++<]>++

*p0を3に→*p0==0まで*p1を10回インクリメント→*p1を2回インクリメント.
*p1をASCIIコード32番,空白にする.

>

p2に移動.

,.,.,.,.,.

*p2に入力→出力を5回

<.>

p1に移動→*p1,つまり空白を出力→p2 に移動.

感想

入力数固定かつ文字列処理は簡単で素晴らしい.

0
0
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
0