Logo
(追記) (追記ここまで)

4935번 - Chop Ahoy! Revisited! 다국어

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

문제

Given a non-empty string composed of digits only, we may group these digits into sub-groups (but maintaining their original order) if, for every sub-group but the last one, the sum of the digits in a sub-group is less than or equal to the sum of the digits in the sub-group immediately on its right. Needless to say, each digit will be in exactly one sub-group.

For example, the string 635 can only be grouped in one sub-group [635] or in two sub-groups as follows: [6-35] (since 6 < 8 .)

Another example is the string 1117 which can be grouped in one sub-group [1117] or as in the following: [1-117], [1-1-17], [1-11-7], [1-1-1-7] , [11-17] , and [111-7] but not any more, hence the total number of possibilities is 7.

Write a program that computes the total number of possibilities of such groupings for a given string of digits.

입력

Your program will be tested on a number of test cases. Each test case is specified on a separate line. Each line contains a single string no longer than 25, and is made of decimal digits only. The end of the test cases is identified by a line made of the word "bye" (without the quotes.) Such line is not part of the test cases.

출력

For each test case, write the result using the following format:

k. n

where k is the test case number (starting at 1,) and n is the result of this test case.

제한

예제 입력 1

635
1117
9876
bye

예제 출력 1

1. 2
2. 7
3. 2

힌트

출처

ICPC > Regionals > Africa and Arab > Arab Collegiate Programming Contest > 2005 Arab Collegiate Programming Contest H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /