A subsequence of a sequence A is a sequence that can be obtained by deleting zero or more elements from A. For a subsequence S of an array A of non-negative integers of length n, we say S is an odd subsequence if and only if it satisfies the following condition:
The sum of elements of S has an odd number of odd digits in its decimal representation.
Given a non-negative integer array A, output the number of distinct odd subsequences of A. To be precise, we treat two subsequences as equivalent if their sorted results are equal.
For instance, for A = [3, 3, 6, 8, 6], your program should output 8:
There are no odd subsequences of A of length 0.
Odd subsequences of A of length 1: [3]
The sum of elements is 3, which has a single odd digit 3
Odd subsequences of A of length 2: [3, 6], [6, 6], [6, 8]
Each subsequence has the sum of 9, 12 and 14, which has a single odd digit 9, 1 and 1, respectively
Odd subsequences of A of length 3: [3, 3, 6], [3, 3, 8]
Odd subsequences of A of length 4: [3, 3, 6, 6], [3, 6, 6, 8]
dlaud5379 1년 전 2
현재 한국어 지문과 영어 지문 모두 예제를 읽지 않으면 이해가 어렵습니다.
한국어 지문에서 '홀수 부분열'의 정의를 다음과 같이 수정해 주세요.
또한, 영어 지문을 다음과 같이 수정해 주세요.
A subsequence of a sequence A is a sequence that can be obtained by deleting zero or more elements from A. For a subsequence S of an array A of non-negative integers of length n, we say S is an odd subsequence if and only if it satisfies the following condition:
Given a non-negative integer array A, output the number of distinct odd subsequences of A. To be precise, we treat two subsequences as equivalent if their sorted results are equal.
For instance, for A = [3, 3, 6, 8, 6], your program should output 8: