给一个定长的元素集,求子串中元素和是K的倍数的最大子串长度。
输入第一行数序列长度,输入第二行是序列各元素值,第三行是整数K
输出序列元素子串和是K倍数的最大长度
分析:
1.元素子串是否都能考虑到,两层循环就可以穷举
2.字串和计算,并不停比对是否是K倍数,若是记录子串长度
3.输出最长子串长度
public class RatioSubstring {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int m;
m = in.nextInt();
int[] input = new int[m];
int i;
for