2016년 9월 8일 목요일
Brain teaser: weighing marbles/coins 여러개의 코인중 무게가 다른 하나 찾기
Q: 이번에는 구슬 대신 코인이 90개가 있는데, 89개는 동일하고
하나만 무게가 다르지만, 그것이 더 무거운지 가벼운지는 모른다.
저울을 한번 잴 때마다 100달러가 든다고 할 때,
무게가 다른 코인을 찾고, 그것이 무거운지 가벼운지를 알아내기위해 필요한
최대 비용을 최소로 하는 방법은 무엇일고, 이 때의 최대 비용은 얼마일까?
Brain teaser: weighing 12 marbles/coins 12 구슬중 무게가 다른 하나 찾기
Q1: 12개의 똑같아 보이는 구슬이 있는데, 오직 하나만이 무게가 살짝 다르다.
더 무거운지 더 가벼운지는 모른다. 저울을 오직 3번만 재서, 무게가 다른 하나를 찾고,
더 무거운지 가벼운지를 알아내라.
There are 12 marbles which have the same look. Among them, only one have
different mass but it is not known whether it is heavier or lighter.
Find odd one by only weighing balance up to 3 times and find out
whether it is lighter or heavier.
더 무거운지 더 가벼운지는 모른다. 저울을 오직 3번만 재서, 무게가 다른 하나를 찾고,
더 무거운지 가벼운지를 알아내라.
There are 12 marbles which have the same look. Among them, only one have
different mass but it is not known whether it is heavier or lighter.
Find odd one by only weighing balance up to 3 times and find out
whether it is lighter or heavier.
2016년 9월 1일 목요일
Brain Teaser: dividing the stick
확률과 관련된 문제로 간단해 보이지만, 의외로 복잡하다.
문제1: 길이가 1인 막대를 임의로(즉, uniform probability로) 2 조각으로 나눌 때,
왼쪽 부분의 길이의 평균은 얼마일까?
문제2: 문제 1과 같은 조건에서, 2 조각중 길이가 가장 짧은 조각의 평균 길이와 길이가 가장 긴 조각의 평균 길이는 각각 얼마일까?
문제3: 길이가 1인 막대를 임의로(즉, uniform probability로) 3 조각으로 나눌 때,
가장 긴 조각의 평균 길이는 얼마일까? 가장 짧은 조각의 평균 길이는?
여기서 막대를 조각으로 나누는 것은 하나, 또는 두개의 임의의 점을 찍는 것과 같다고 생각할 수 있다.
Q1: There is a stick with length 1. If you randomly divide the stick into two pieces,
what is the average length of the left part ?
Q2: There is a stick with length 1. If you randomly divide the stick into two pieces,
what is the average length of the longest part ?
Q3: There is a stick with length 1. If you randomly divide the stick into three pieces,
what is the average length of the longest part ?
문제1: 길이가 1인 막대를 임의로(즉, uniform probability로) 2 조각으로 나눌 때,
왼쪽 부분의 길이의 평균은 얼마일까?
문제2: 문제 1과 같은 조건에서, 2 조각중 길이가 가장 짧은 조각의 평균 길이와 길이가 가장 긴 조각의 평균 길이는 각각 얼마일까?
문제3: 길이가 1인 막대를 임의로(즉, uniform probability로) 3 조각으로 나눌 때,
가장 긴 조각의 평균 길이는 얼마일까? 가장 짧은 조각의 평균 길이는?
여기서 막대를 조각으로 나누는 것은 하나, 또는 두개의 임의의 점을 찍는 것과 같다고 생각할 수 있다.
Q1: There is a stick with length 1. If you randomly divide the stick into two pieces,
what is the average length of the left part ?
Q2: There is a stick with length 1. If you randomly divide the stick into two pieces,
what is the average length of the longest part ?
Q3: There is a stick with length 1. If you randomly divide the stick into three pieces,
what is the average length of the longest part ?
Brain Teaser: boy or girl?
Q: I met a man with two children and I know one of them is a boy.
What is the probability that the other children is also a boy?
If I know one boy's birthday is Tuesday,
what is the probability that the other children is also a boy?
아이가 둘인 사람을 만났는데, 그 중 적어도 한명은 남자라는 것을 안다고 하자.
이 때, 다른 아이도 남자아이일 확률은?
만약, 남자애가 화요일에 태어났다는 것을 안다면, 다른 아이가 남자아이일 확률은?
What is the probability that the other children is also a boy?
If I know one boy's birthday is Tuesday,
what is the probability that the other children is also a boy?
아이가 둘인 사람을 만났는데, 그 중 적어도 한명은 남자라는 것을 안다고 하자.
이 때, 다른 아이도 남자아이일 확률은?
만약, 남자애가 화요일에 태어났다는 것을 안다면, 다른 아이가 남자아이일 확률은?
2016년 7월 24일 일요일
dos file to linux/unix file
Removing ^M from file:
There are several ways to do it
(1) Using Vi editor
(1-1) To remove the ^M character, in ViM, write the following in the command mode and press :w to save the changes:
:set fileformat=unix
(1-2) Or, type this script in ViM, in the command mode and type :w to save the changes:
^V^M gives ^M character in the screen
:1,$s/^V^M//g
(2) Use sed:
$ sed 's/^M//g' filename > newfilename
(3) Use Dos2Unix
$ dos2unix filename newfilename
(4) Use col:
$ cat filename | col -b > newfilename
(5) Use 'tr' :
$tr -d '\r' < inputfile > outputfile
2016년 6월 10일 금요일
ipython install for OSX El Capitan
컴퓨터를 Mac 으로 바꾸고 ipython 을 설치하려니 문제가 생겼다.
먼저 pip install ipython 을 시도했지만, pip 가 설치되어 있지 않음.
그래서 일단 pip 를 설치.( sudo easy_install pip )
다시 pip 로 ipython 을 설치하려 했지만, 실패.
아마도 Apple의 정책상 시스템과 관련된 디렛토리에 쓰는 것이 금지 된 듯.
이번에는 sudo easy_install ipython 을 시도했으나 역시 에러 발생. (six 라는
프로그램의 버전이 문제인 듯.)
결국 다음과 같은 방법으로 설치 성공. (설치하는 김에 python3도 설치했다.)
sudo pip install haxor-news --upgrade --ignore-installed six
2016년 1월 5일 화요일
vmware에서 guest resize problem
vmware에서 어느 순간부터 guest os 의 windows size를 바꾸지 못하는 문제가 발생했다.
다양하게 시도해 본 결과 linux에서 open-vm-tools 가 제대로 설치되지 않은 것이 문제 인것으로 보인다.
Ubuntu에서
open-vm-tools
open-vm-tools-desktop
을 재설치 하는 것으로 해결되었다.
다양하게 시도해 본 결과 linux에서 open-vm-tools 가 제대로 설치되지 않은 것이 문제 인것으로 보인다.
Ubuntu에서
open-vm-tools
open-vm-tools-desktop
을 재설치 하는 것으로 해결되었다.
피드 구독하기:
글 (Atom)