度小满笔试
- 不知道有多少人是被那个内推贴骗了,内推过筛免笔试?不存在的。。。
- 笔试是不可能做笔试的,这辈子都不会做笔试的(真香)好未来这种sb公司的笔试我都做了两次,并且依然没有收到面试,没办法,零offer选手就是这么卑微
- A了1.91,第二题不知道卡了哪个用例,想了一会想不出来直接交了,有老哥知道的麻烦告知下,下面附代码
1、涂色
public class test1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str1 = sc.nextLine(); String str2 = sc.nextLine(); char[] chars1 = str1.toCharArray(); char[] chars2 = str2.toCharArray(); int res = 0; HashMap<Character,Integer> map = new HashMap<Character, Integer>(); for (int i = 0;i < chars1.length;i++) { if (map.containsKey(chars1[i])) map.put(chars1[i],map.get(chars1[i])+1); else map.put(chars1[i],1); } for (int i = 0;i < chars2.length;i++) { if (map.containsKey(chars2[i])) { if (map.get(chars1[i]) == 1) map.remove(chars1[i]); else map.put(chars1[i],map.get(chars1[i])-1); res++; } } System.out.println(res); } }
2、相似字符串
public class test2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String q = sc.nextLine(); for(int i = 0;i < n;i++) { String str = sc.nextLine(); String[] strs = new String[str.length()/3]; boolean res = true; int z = 0; for (int m = 0;m < str.length();m = m + 3) { strs[z++] = str.substring(m,m+3); } // printString(strs); for (int x = 0;x < strs.length;x++) { for (int y = x+1;y < strs.length;y++){ if (!isValid(strs[x],strs[y])) res = false; } } if (res) System.out.println("Yes"); else System.out.println("No"); } } // public static void printString(String[] strs) // { // for (String str : strs) // System.out.print(str +" "); // System.out.println(); // } public static boolean isValid(String str1,String str2) { int dif = 0; for (int i = 0;i < 3;i++) { if (str1.charAt(i) != str2.charAt(i)) dif++; } return dif < 2; } }#笔试题目##度小满#