import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main {     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         String str = in.nextLine();         String[] strs = str.split("\\、");         int c = Integer.parseInt(strs[0]);         int b = Integer.parseInt(strs[1]);         int f1,f2,f3,f4;         int count = 1;         Map<Integer, Integer> map = new HashMap<>();         for(int i = 2;i < strs.length; ++i) {             int temp = Integer.parseInt(strs[i]);             f1 = temp >> 24;             f2 = (temp & 0x00FFFFFF)>>16;             f3 = (temp  & 0x0000FFFF) >> 8;             f4 = (temp & 0x000000FF);             int sum = f1 + f2 + f3 + f4;             int tt = sum % b;             if(tt < c) {                 if(map.containsKey(tt)) {                     int x = map.get(tt) + 1;                     map.put(tt, x);                     if(x > count) {                         count = x;                     }                 } else {                     map.put(tt, 1);                 }                              }         }         System.out.println(count);              } }
点赞 1

相关推荐

牛客网
牛客企业服务