시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 256 MB 258 124 85 45.699%

문제

증가하는 수는 수의 각 자리가 증가하거나 같은 경우이다.

예를 들어서, 다음 세 가지 수를 보자.

  • 123
  • 101
  • 1111000001111

123은 1<2<3이므로 증가하는 수이다. 하지만 101은 1>0<1이고, 1111000001111은 1=1=1=1>0=0=0=0=0<1=1=1=1이므로 증가하는 수가 아니다.

입력

입력은 테스트 케이스의 수로 시작한다.

각 테스트 케이스에는 한 자연수만 있다. 자연수는 80자리 수를 넘지 않는다.

출력

각 테스트 케이스별로 판단한다.

수가 증가하는 수가 아니면, -1을 출력한다.

그 수가 증가하는 수이면, 그 수보다 작은 증가하는 정수의 개수를 출력한다.

각 테스트 케이스별 출력은 64-bit 길이여야 한다.

예제 입력 1

5
11
123
101
1111
99999

예제 출력 1

10
65
-1
220
2001

힌트

모든 자리 수가 같으면, 증가하는 수이다.

W3sicHJvYmxlbV9pZCI6IjEwNTczIiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVjOTlkXHVhYzAwXHVkNTU4XHViMjk0IFx1YzIxOCIsImRlc2NyaXB0aW9uIjoiPHA+XHVjOTlkXHVhYzAwXHVkNTU4XHViMjk0IFx1YzIxOFx1YjI5NCBcdWMyMThcdWM3NTggXHVhYzAxIFx1Yzc5MFx1YjlhY1x1YWMwMCBcdWM5OWRcdWFjMDBcdWQ1NThcdWFjNzBcdWIwOTggXHVhYzE5XHVjNzQwIFx1YWNiZFx1YzZiMFx1Yzc3NFx1YjJlNC48XC9wPlxyXG5cclxuPHA+XHVjNjA4XHViOTdjIFx1YjRlNFx1YzViNFx1YzExYywgXHViMmU0XHVjNzRjIFx1YzEzOCBcdWFjMDBcdWM5YzAgXHVjMjE4XHViOTdjIFx1YmNmNFx1Yzc5MC48XC9wPlxyXG5cclxuPHVsPlxyXG5cdDxsaT4xMjM8XC9saT5cclxuXHQ8bGk+MTAxPFwvbGk+XHJcblx0PGxpPjExMTEwMDA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PFwvcD5cclxuXHJcbjx1bD5cclxuXHQ8bGk+MTIzIGlzIGEgcmFtcCBudW1iZXIuPFwvbGk+XHJcblx0PGxpPjEwMSBpcyBub3QgYSByYW1wIG51bWJlci48XC9saT5cclxuXHQ8bGk+MTExMTAwMDAwMTExMSBpcyBub3QgYSByYW1wIG51bWJlci48XC9saT5cclxuPFwvdWw+XHJcblxyXG48cD5HaXZlbiBhIHBvc2l0aXZlIGludGVnZXIgbiwgaWYgaXQgaXMgYSByYW1wIG51bWJlciwgcHJpbnQgdGhlIG51bWJlciBvZiByYW1wIG51bWJlcnMgbGVzcyB0aGFuIGl0LiBJZiBpdCBpcyBub3QgYSByYW1wIG51bWJlciwgcHJpbnQgLTEuPFwvcD5cclxuIiwiaW5wdXQiOiI8cD5JbnB1dCB3aWxsIHN0YXJ0IHdpdGggYSBzaW5nbGUgbGluZSBnaXZpbmcgdGhlIG51bWJlciBvZiB0ZXN0IGNhc2VzLiBFYWNoIHRlc3QgY2FzZSB3aWxsIGJlIGEgc2luZ2xlIHBvc2l0aXZlIGludGVnZXIgb24gYSBzaW5nbGUgbGluZSwgd2l0aCB1cCB0byA4MCBkaWdpdHMuIFRoZSByZXN1bHQgd2lsbCBhbHdheXMgZml0IGludG8gYSA2NC1iaXQgbG9uZy48XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5Gb3IgZWFjaCB0ZXN0IGNhc2UsIHByaW50IC0xIGlmIHRoZSBpbnB1dCBpcyBub3QgYSByYW1wIG51bWJlci4gUHJpbnQgdGhlIG51bWJlciBvZiByYW1wIG51bWJlcnMgbGVzcyB0aGFuIHRoZSBpbnB1dCB2YWx1ZSBpZiB0aGUgaW5wdXQgdmFsdWUgaXMgYSByYW1wIG51bWJlci48XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2014 Pacific Northwest Region Programming Contest Division 2 R번