Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4. 語呂合わせ #4

Open
yuji96 opened this issue Feb 9, 2020 · 0 comments
Open

4. 語呂合わせ #4

yuji96 opened this issue Feb 9, 2020 · 0 comments

Comments

@yuji96
Copy link
Owner

yuji96 commented Feb 9, 2020

pi_string

それぞれの英単語のアルファベットの数を数えて並べると円周率になる。

例)
英文 : May I have a large container of coffee
円周率: 3.1415926

TODO

quiz/circle_digits.txtを読み込んで語呂合わせの文字列を取得し、
この文字列を用いて円周率を402桁まで求めよ。
以下、入力方法と出力方法の規則。

  • ピリオド.は無視する。
  • ピリオド以外の記号:,—!="()が独立して存在している位置は0とする。
    • つまり、" 3 "は記号が独立しているから010だが、"3"は記号が文字と隣接しているので3というふうに語呂を数字に変換する。
  • float型は402桁も扱えないので、str型で出力する。

Comment

ユーザーは開発者の想定通りに入力してくれない。例えば電話番号だと人によって0120-aaa-aaa0120(aaa)aaaだったりする。
これはwebアプリの入力フォームだけの問題ではなく、どの分野のエンジニアも対応できるようになる必要がある。
ちなみに正規表現を使うとトリッキーな文字列操作ができたりする。

関連

@yuji96 yuji96 transferred this issue from another repository May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant