Блог пользователя alpha_1001

Автор alpha_1001, история, 3 года назад, По-английски

Is there any general way of approaching any problems like this...

Suppose, Given two arrays A and B, we have to select any subsequence of A, which satisfies the given properties (XYZ) having minimum or maximum value.

Suppose any selected subsequence of A is S = {A_i1, A_i2, A_i3, ..., A_ik} which satisfy the given properties (XYZ), then the value of Subsequence S is V = {B_i1 @ B_i2 @ B_i3 @ ... @ B_ik}, where @ is any function.

Our goal is to minimize or maximize or ..., the value V of subsequence S.

P.S.: Share any resources related to this, if any.

Problem 1 : 510D - Fox And Jumping

Share your own way to solve problems like this.

P.S.: Comments some more related problems, if you know.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

Автор alpha_1001, история, 3 года назад, По-английски
Given a string **S** consisting of digits [0-9], count the number of ways this string can be split into continuous substrings such that each substring is a prime number. Each digit must be in one substring and the entire string must be used.

**Note:**
The input string does not contain leading zeros.
Each number split of the given number must be in the range `2 to 1e6` inclusive.
Since the answer can be large, return the answer modulo `1e9+7`.


**Constraints**
1 <= | S | <= 1e5

**Example**
_input_
11373
_output_
6
_Explanation_
[11, 3, 7, 3], [11, 3, 73], [11, 37, 3], [113, 7, 3], [113, 73], [11, 373].


Can anyone help me out?
Thanks in advance.
Happy Coding...
 
P.S.: This is my first blog, so correct me if I'm wrong anywhere.

Feel free to share your approach.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -24
  • Проголосовать: не нравится