시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 128 MB98756649860.880%

문제

민승이는 N(1 ≤ N ≤ 1,000,000)명의 학생들에게 양의 정수로 된 라벨을 붙이려고 한다. 하지만 모든 학생들은 숫자 L(0 ≤ L ≤ 9)이 자신의 라벨 숫자에 포함되길 원치 않는다. 

문제는 학생들에게 숫자 L을 쓰지 않고 최소한 작은 N개의 양의 수 세트를 라벨링 할 때 학생들이 받는 라벨 중 가장 큰 수가 몇인지를 구하는 것이다.

입력

첫째 줄에 N과 L이 공백으로 구분되어 주어진다.

출력

첫째 줄에 민승이가 학생들에게 붙이는 라벨 중 가장 큰 수를 출력한다.

예제 입력 1

10 1

예제 출력 1

22

힌트

민승이는 가장 작은 10개의 수 2, 3, 4, 5, 6, 7, 8, 9, 20, 22를 사용하여 라벨을 붙일 수 있다.

W3sicHJvYmxlbV9pZCI6IjE2ODEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM5MDQgXHVjMTM4XHVjNmIwXHVhZTMwIiwiZGVzY3JpcHRpb24iOiI8cD5cdWJiZmNcdWMyYjlcdWM3NzRcdWIyOTQgTigxICZsZTsgTiAmbGU7IDEsMDAwLDAwMClcdWJhODVcdWM3NTggXHVkNTU5XHVjMGRkXHViNGU0XHVjNWQwXHVhYzhjIFx1YzU5MVx1Yzc1OCBcdWM4MTVcdWMyMThcdWI4NWMgXHViNDFjIFx1Yjc3Y1x1YmNhOFx1Yzc0NCBcdWJkOTlcdWM3NzRcdWI4MjRcdWFjZTAgXHVkNTVjXHViMmU0LiBcdWQ1NThcdWM5YzBcdWI5Y2MgXHViYWE4XHViNGUwIFx1ZDU1OVx1YzBkZFx1YjRlNFx1Yzc0MCBcdWMyMmJcdWM3OTAgTCgwICZsZTsgTCAmbGU7IDkpXHVjNzc0IFx1Yzc5MFx1YzJlMFx1Yzc1OCBcdWI3N2NcdWJjYTggXHVjMjJiXHVjNzkwXHVjNWQwIFx1ZDNlY1x1ZDU2OFx1Yj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IEwuPFwvcD5cclxuXHJcbjxwPiZuYnNwOzxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPiogTGluZSAxOiBBIHNpbmdsZSBpbnRlZ2VyIHRoYXQgaXMgdGhlIGxhcmdlc3QgbnVtYmVyIHRoYXQgRmFybWVyIEpvaG4gaGFzIHRvIHdyaXRlIG9uIGFueSBjb3cuPFwvcD5cclxuXHJcbjxwPiZuYnNwOzxcL3A+XHJcbiIsImhpbnQiOiI8cD5UaGUgc21hbGxlc3QgMTAgbnVtYmVycyBoZSBjYW4gdXNlIGFyZTogMiwgMywgNCwgNSwgNiwgNywgOCwgOSwgMjAsIGFuZCAyMi48XC9wPlxyXG5cclxuPHA+Jm5ic3A7PFwvcD5cclxuIiwib3JpZ2luYWwiOiIxIiwiaHRtbF90aXRsZSI6IjAiLCJwcm9ibGVtX2xhbmdfdGNvZGUiOiJFbmdsaXNoIn1d

출처

Olympiad > USA Computing Olympiad > 2006-2007 Season > USACO US Open 2007 Contest > Bronze 3번

  • 문제를 번역한 사람: author6