시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1527 859 794 59.431%

문제

창영이는 여러 가지 진법을 공부하고 있다. 창영이는 어제 2진법을 배웠고, 오늘은 8진법을 배웠다. 이제, 2진법 수를 8진법 수로 변환하려고 한다.

창영이가 사용한 방법은 다음과 같다.

  1. 2진수의 길이가 3으로 나누어 떨어질 때 까지 수의 앞에 0을 붙인다.
  2. 그 다음, 3자리씩 그룹을 나눈다.
  3. 아래의 표를 참고해 8진수로 바꾼다.

2진수가 주어졌을 때, 창영이가 사용한 방법을 이용해 8진수로 바꾸는 프로그램을 작성하시오.

000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7

입력

첫째 줄에 2진수가 주어진다. 이 수는 100자리 이내이고, 첫 번째 자리는 1이다.

출력

첫째 줄에 8진수를 출력한다.

예제 입력 1

1010

예제 출력 1

12
W3sicHJvYmxlbV9pZCI6IjI5OTgiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiI4XHVjOWM0XHVjMjE4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWNjM2RcdWM2MDFcdWM3NzRcdWIyOTQgXHVjNWVjXHViN2VjIFx1YWMwMFx1YzljMCBcdWM5YzRcdWJjOTVcdWM3NDQgXHVhY2Y1XHViZDgwXHVkNTU4XHVhY2UwIFx1Yzc4OFx1YjJlNC4gXHVjYzNkXHVjNjAxXHVjNzc0XHViMjk0IFx1YzViNFx1YzgxYyAyXHVjOWM0XHViYzk1XHVjNzQ0IFx1YmMzMFx1YzZlMFx1YWNlMCwgXHVjNjI0XHViMjk4XHVjNzQwIDhcdWM5YzRcdWJjOTVcdWM3NDQgXHViYzMwXHVjNmUwXHViMmU0LiBcdWM3NzRcdWM4MWMsIDJcdWM5YzRcdWJjOTUgXHVjMjE4XHViOTdjIDhcdWM5YzRcdWJjOTUgXHVjMjE4XHViODVjIFx1YmNjMFx1ZDY1OFx1ZDU1OFx1YjgyNFx1YWNlMCBcdWQ1NWNcdWIyZTQ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lxyXG5cdFx0PFwvdHI+XHJcblx0XHQ8dHI+XHJcblx0XHRcdDx0ZD4xMTA8XC90ZD5cclxuXHRcdFx0PHRkPjY8XC90ZD5cclxuXHRcdDxcL3RyPlxyXG5cdFx0PHRyPlxyXG5cdFx0XHQ8dGQ+MTExPFwvdGQ+XHJcblx0XHRcdDx0ZD43PFwvdGQ+XHJcblx0XHQ8XC90cj5cclxuXHQ8XC90Ym9keT5cclxuPFwvdGFibGU+IiwiaW5wdXQiOiI8cD5UaGUgaW5wdXQgY29udGFpbnMgYSBiaW5hcnkgbnVtZXJhbC4gVGhlIG51bWJlciBvZiBkaWdpdHMgd2lsbCBiZSBsZXNzIHRoYW4gMTAwLCBhbmQgdGhlIGZpcnN0IGRpZ2l0IHdpbGwgYmUgMS4mbmJzcDs8XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5PdXRwdXQgdGhlIG51bWJlciBpbiBvY3RhbC4mbmJzcDs8XC9wPlxyXG5cclxuPHA+Jm5ic3A7PFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

Contest > Croatian Open Competition in Informatics > COCI 2007/2008 > Contest #3 2번

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: sky1357