哈希很占内存吗??????
查看原帖
哈希很占内存吗??????
693079
azhe_DaShu楼主2022/10/4 19:54

import java.util.HashMap;
public class Main1 {
	
	public static void main(String[] args) {
		int x,y,z;
		HashMap<Integer,Integer> map = new HashMap<Integer, Integer>();
		for (int i = 100; i <=333; i++) {
			
			x=i;
			y=2*i;
			z=3*i;
			map.clear();
			map.put(x%10,1);
			map.put((x/10)%10,1);
			map.put((x/100)%10,1);
			map.put(y%10,1);
			map.put((y/10)%10,1);
			map.put((y/100)%10,1);
			map.put(z%10,1);
			map.put((z/10)%10,1);
			map.put((z/100)%10,1);
			if (map.size()==9) {
				System.out.println(x+" "+y+" "+z);
			}
		}
	}	
}

2022/10/4 19:54
加载中...