시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 256 MB 155 82 58 47.154%

문제

증가하는 수는 더 높은 자릿수가 더 낮은 자리수와 같거나 더 낮은 자리수보다 더 큰 정수를 말한다.

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

  • 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+XHVjOTlkXHVhYzAwXHVkNTU4XHViMjk0IFx1YzIxOFx1YjI5NCBcdWIzNTQgXHViMTkyXHVjNzQwIFx1Yzc5MFx1YjliZlx1YzIxOFx1YWMwMCBcdWIzNTQgXHViMGFlXHVjNzQwIFx1Yzc5MFx1YjlhY1x1YzIxOFx1YzY0MCBcdWFjMTlcdWFjNzBcdWIwOTggXHViMzU0IFx1YjBhZVx1Yzc0MCBcdWM3OTBcdWI5YWNcdWMyMThcdWJjZjRcdWIyZTQmbmJzcDtcdWIzNTQgXHVkMDcwIFx1YzgxNVx1YzIxOFx1Yjk3YyBcdWI5ZDBcdWQ1NWNcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1YzYwOFx1Yjk3YyBcdWI0ZTRcdWM1Y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udW1iZXJzIGxlc3MgdGhhbiB0aGUgaW5wdXQgdmFsdWUgaWYgdGhlIGlucHV0IHZhbHVlIGlzIGEgcmFtcCBudW1iZXIuPFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

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