시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB29941766164661.810%

문제

창영이는 여러 가지 진법을 공부하고 있다. 창영이는 어제 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

예제 입력 2

11001100

예제 출력 2

314
W3sicHJvYmxlbV9pZCI6IjI5OTgiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiI4XHVjOWM0XHVjMjE4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWNjM2RcdWM2MDFcdWM3NzRcdWIyOTQgXHVjNWVjXHViN2VjIFx1YWMwMFx1YzljMCBcdWM5YzRcdWJjOTVcdWM3NDQgXHVhY2Y1XHViZDgwXHVkNTU4XHVhY2UwIFx1Yzc4OFx1YjJlNC4gXHVjYzNkXHVjNjAxXHVjNzc0XHViMjk0IFx1YzViNFx1YzgxYyAyXHVjOWM0XHViYzk1XHVjNzQ0IFx1YmMzMFx1YzZlMFx1YWNlMCwgXHVjNjI0XHViMjk4XHVjNzQwIDhcdWM5YzRcdWJjOTVcdWM3NDQgXHViYzMwXHVjNmUwXHViMmU0LiBcdWM3NzRcdWM4MWMsIDJcdWM5YzRcdWJjOTUgXHVjMjE4XHViOTdjIDhcdWM5YzRcdWJjOTUgXHVjMjE4XHViODVjIFx1YmNjMFx1ZDY1OFx1ZDU1OFx1YjgyNFx1YWNlMCBcdW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HQ8dGQ+MTEwPFwvdGQ+XHJcblx0XHRcdDx0ZD42PFwvdGQ+XHJcblx0XHQ8XC90cj5cclxuXHRcdDx0cj5cclxuXHRcdFx0PHRkPjExMTxcL3RkPlxyXG5cdFx0XHQ8dGQ+NzxcL3RkPlxyXG5cdFx0PFwvdHI+XHJcblx0PFwvdGJvZHk+XHJcbjxcL3RhYmxlPlxyXG4iLCJpbnB1dCI6IjxwPlRoZSBpbnB1dCBjb250YWlucyBhIGJpbmFyeSBudW1lcmFsLiBUaGUgbnVtYmVyIG9mIGRpZ2l0cyB3aWxsIGJlIGxlc3MgdGhhbiAxMDAsIGFuZCB0aGUgZmlyc3QgZGlnaXQgd2lsbCBiZSAxLiZuYnNwOzxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPk91dHB1dCB0aGUgbnVtYmVyIGluIG9jdGFsLiZuYnNwOzxcL3A+XHJcblxyXG48cD4mbmJzcDs8XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwiaHRtbF90aXRsZSI6IjAiLCJwcm9ibGVtX2xhbmdfdGNvZGUiOiJFbmdsaXNoIn1d

출처

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

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