/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { static void shuffle(int[] list) { for (int i = 0; i < list.length; ++i) { int a = i; int b = rand.nextInt(list.length - i) + i; // Swap int t = list[a]; list[a] = list[b]; list[b] = t; } } { // your code goes here // Init int[] list = new int[1000]; init(list); shuffle(list); show(list); analyze(list); shuffle(list); analyze(list); init(list); shuffle(list); analyze(list); init(list); shuffle(list); analyze(list); for (int i = 0; i < 10; ++i) { shuffle(list); } analyze(list); list = new int[3000]; init(list); shuffle(list); analyze(list); for (int i = 0; i < 10; ++i) { shuffle(list); } analyze(list); for (int j = 0; j < 3; ++j) { list = new int[100]; init(list); shuffle(list); analyze(list); for (int i = 0; i < 10; ++i) { shuffle(list); } analyze(list); } } static int makeValue(int n) { return n / 10; } static void init(int[] list) { for (int i = 0; i < list.length; ++i) { list[i] = makeValue(i); } } static void show(int[] list) { for (int n : list) { } } static void analyze(int[] list) { int sum = 0; for (int i = 1; i < list.length; ++i) { } double avg = (double)sum / (double)(list.length - 1); double s2 = 0.0; for (int i = 1; i < list.length; ++i) { s2 += (avg - diff) * (avg - diff); } s2 /= (double)(list.length - 1); int count = 0; for (int i = 0; i < list.length; ++i) { int v = makeValue(i); if (v == list[i]) { ++count; } } int suc = 0; for (int i = 1; i < list.length; ++i) { if (list[i] == list[i - 1]) { ++suc; } } } }
Standard input is empty
52 57 98 84 99 98 39 8 64 66 96 50 19 28 67 8 34 18 29 67 87 23 58 7 25 51 35 59 43 80 54 40 2 36 88 32 34 21 90 32 8 92 46 45 91 7 67 13 86 86 8 79 16 7 38 43 36 72 18 39 9 73 54 39 69 47 6 70 56 31 61 68 32 35 68 22 4 10 13 76 33 93 64 35 56 14 2 71 75 32 44 99 78 0 5 91 15 83 11 50 28 94 29 94 16 43 17 85 50 39 51 5 48 35 74 8 75 77 21 82 45 23 32 96 9 58 89 52 75 83 44 75 29 69 98 1 56 6 16 91 5 81 56 47 63 42 8 51 0 56 37 71 1 21 83 95 88 84 70 78 23 21 66 38 92 64 38 12 30 27 3 87 99 15 69 90 27 14 73 1 54 36 86 49 56 93 87 11 73 76 52 27 2 33 49 54 71 1 90 60 36 26 53 47 19 21 64 92 88 92 55 39 59 69 53 28 20 40 5 86 83 28 2 64 2 76 80 66 87 85 62 53 41 3 67 33 28 90 27 6 94 38 94 84 38 58 63 3 9 82 80 64 20 73 97 59 21 49 63 8 54 72 27 37 55 98 89 47 11 54 22 39 71 23 20 7 2 98 61 19 49 23 49 39 54 6 30 24 50 19 28 47 44 47 97 57 29 37 4 41 45 28 45 94 7 10 65 93 82 31 89 42 16 81 81 88 58 25 63 52 45 67 9 89 30 50 32 82 82 54 26 39 42 90 62 16 85 31 90 87 43 75 86 36 26 52 81 38 12 57 99 13 89 34 46 61 33 20 48 80 88 97 36 69 61 91 86 11 15 13 62 96 56 66 11 75 71 9 93 31 1 49 76 89 54 29 15 32 72 21 4 77 77 61 76 57 20 67 73 92 65 85 24 58 61 35 71 92 88 3 42 79 27 18 26 94 16 72 17 70 25 4 1 78 55 64 87 1 26 18 94 58 9 50 72 65 53 8 28 66 22 11 46 59 7 47 86 93 30 19 43 78 97 19 17 7 74 82 13 68 17 84 68 21 4 38 12 78 34 52 24 39 55 92 20 15 41 41 27 95 0 53 2 30 42 6 46 35 59 43 81 45 44 31 0 44 99 52 78 79 34 98 68 6 20 6 90 77 31 33 90 78 76 22 87 71 52 60 35 4 88 63 18 71 97 79 91 96 18 27 13 91 98 10 64 94 3 36 80 74 73 98 19 31 51 96 92 0 88 33 48 68 26 46 85 6 29 84 0 31 26 7 14 31 97 81 10 73 11 70 50 47 76 97 97 3 37 99 42 5 91 83 35 33 77 77 10 96 65 89 52 22 87 25 42 74 70 67 21 24 57 95 67 84 40 4 17 55 24 60 74 96 48 77 22 48 62 99 25 38 73 84 78 18 94 17 23 3 14 80 9 22 15 79 48 51 25 43 24 40 7 40 89 63 97 13 10 66 77 38 42 59 89 99 14 11 48 43 41 76 81 81 44 10 46 5 35 46 68 12 24 6 14 24 95 51 31 62 93 13 42 12 34 25 69 69 17 33 87 11 62 19 75 60 94 78 36 48 40 41 16 8 28 49 12 61 97 57 55 26 63 85 29 61 40 48 83 71 41 57 46 59 65 87 90 72 20 4 12 63 0 37 29 55 50 67 64 93 48 28 81 35 33 96 95 80 15 9 3 60 84 86 93 18 24 76 62 14 1 60 34 59 12 44 4 9 16 59 60 53 23 43 75 20 16 44 61 24 25 32 85 95 44 46 27 80 66 22 74 47 65 73 37 74 75 20 42 53 66 90 49 27 16 2 22 72 55 72 52 51 37 62 65 0 17 36 41 91 58 70 60 2 15 95 62 13 74 56 6 92 60 5 68 0 1 56 49 81 77 95 60 65 2 10 53 95 44 91 82 51 45 86 80 41 83 79 30 25 58 51 19 11 96 89 45 63 1 3 39 18 78 86 70 79 23 61 98 29 93 14 46 10 5 75 37 30 69 82 62 15 57 45 82 55 19 5 13 14 68 56 53 76 69 50 95 72 51 17 40 45 99 77 21 65 41 23 3 5 83 79 84 40 72 58 32 26 64 88 68 70 55 36 30 49 88 73 92 26 65 53 34 96 0 74 12 32 79 67 29 85 85 66 15 34 17 43 59 30 93 22 10 98 9 63 12 58 34 4 18 25 79 37 8 37 57 40 83 69 74 30 66 23 71 57 83 7 47 14 80 50 33 85 91 99 70 84 38 82 54 70 [new 1000]shuffle ** analyze ** diff avg: 32.712712712712715 diff s2: 529.1537022507994 stay: 8 succeession: 10 shuffle one more ** analyze ** diff avg: 34.63563563563564 diff s2: 574.692063434806 stay: 12 succeession: 7 [new 1000]shuffle ** analyze ** diff avg: 33.272272272272275 diff s2: 570.8888307727154 stay: 5 succeession: 4 [new 1000]shuffle ** analyze ** diff avg: 34.31831831831832 diff s2: 580.9637385132884 stay: 12 succeession: 6 shuffle 10 times ** analyze ** diff avg: 33.048048048048045 diff s2: 562.8024961898839 stay: 9 succeession: 13 [new 3000]shuffle ** analyze ** diff avg: 98.09103034344781 diff s2: 4832.770973229821 stay: 8 succeession: 12 shuffle 10 times ** analyze ** diff avg: 100.6322107369123 diff s2: 5009.1301528652275 stay: 6 succeession: 7 [new 100]shuffle ** analyze ** diff avg: 3.5353535353535355 diff s2: 6.753800632588512 stay: 10 succeession: 9 shuffle 10 times ** analyze ** diff avg: 3.6565656565656566 diff s2: 5.154780124477092 stay: 8 succeession: 6 [new 100]shuffle ** analyze ** diff avg: 3.6464646464646466 diff s2: 6.289154167942048 stay: 10 succeession: 4 shuffle 10 times ** analyze ** diff avg: 3.2626262626262625 diff s2: 5.830017345168859 stay: 8 succeession: 8 [new 100]shuffle ** analyze ** diff avg: 3.3838383838383836 diff s2: 6.0142842567085 stay: 9 succeession: 8 shuffle 10 times ** analyze ** diff avg: 3.6464646464646466 diff s2: 5.359861238649117 stay: 6 succeession: 7