Dãy số #5

View as PDF

Submit solution

Points: 100.00 (partial)
Time limit: 1.0s
Memory limit: 102M
Input: stdin
Output: stdout

Author:
Problem type

Nhập vào dãy ~A~ có ~n~ phần tử. Tính đoạn con dài nhất chứa các phần tử đều chia hết cho ~k~ trong dãy ~A~

Input
  • Số nguyên dương ~n, k~ ~(1 \leq n \leq 1000, 1 \leq k \leq 10^6)~
  • ~n~ số nguyên ~a_1,a_2,...,a_n~ ~(-10^6 \leq a_i \leq 10^6)~
Output
  • In ra độ dài của đoạn con tìm được
Example

Input

8 2
1 2 2 -2 6 -4 3 3

Output

5

Comments

Please read the guidelines before commenting.


There are no comments at the moment.