-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3.5-Statistica valori
93 lines (79 loc) · 2.52 KB
/
3.5-Statistica valori
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import java.util.*;
public class Teianu{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int m = sc.nextInt();
int n= sc.nextInt();
int[][] matrix=new int[m][n];
ArrayList<Integer> aList=new ArrayList<Integer>();
int zeros=0;
int ones=0;
int twos=0;
int threes=0;
int fours=0;
int fives=0;
int sixs=0;
int sevens=0;
int eights=0;
int nines=0;
int sum=0;
ArrayList<Double> Ha=new ArrayList<Double>();
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
matrix[i][j]=sc.nextInt();
sum+=matrix[i][j];
if (matrix[i][j]==0){
zeros++;
}
if (matrix[i][j]==1){
ones++;
}
if (matrix[i][j]==2){
twos++;
}
if (matrix[i][j]==3){
threes++;
}
if (matrix[i][j]==4){
fours++;
}
if (matrix[i][j]==5){
fives++;
}
if (matrix[i][j]==6){
sixs++;
}
if (matrix[i][j]==7){
sevens++;
}
if (matrix[i][j]==8){
eights++;
}
if (matrix[i][j]==9){
nines++;
}
}
}
aList.add(zeros);
aList.add(ones);
aList.add(twos);aList.add(threes);aList.add(fours);aList.add(fives);aList.add(sixs);aList.add(sevens);aList.add(eights);
aList.add(nines);
double d=0;
double sumulita=0;
for(int z=0;z<aList.size();z++){
sumulita+=aList.get(z);
}
double medie=sumulita/10;
for(int k=0;k<aList.size();k++){
d=d + (Math.pow((aList.get(k)-medie),2));
}
d=Math.sqrt(d/10);
int count=0;
for(int x=0;x<aList.size();x++){
if( (double)aList.get(x)>=d){
count++;
}
}
System.out.println(count);
}
}