标签:
1 public class Solution 2 { 3 public static void main(String[] args) 4 { 5 boolean[] box = new boolean[101]; 6 7 for(int i = 1; i <= 100; i++) 8 { 9 for(int j = i; j <= 100; j += i) 10 changeBox(box, j); 11 } 12 13 for(int i = 1; i <= 100; i++) 14 System.out.printf("%d\t%b\n", i, box[i]); 15 } 16 17 public static void changeBox(boolean[] array, int flag) 18 { 19 if(array[flag] == true) 20 array[flag] = false; 21 else 22 array[flag] = true; 23 } 24 }
标签:
原文地址:http://www.cnblogs.com/wood-python/p/5814804.html