-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1012.cpp
More file actions
73 lines (57 loc) · 892 Bytes
/
1012.cpp
File metadata and controls
73 lines (57 loc) · 892 Bytes
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
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
cin >> n;
int num;
int A1 = 0, A3 = 0, A5 = 0, i = 0, l = 0, A2 = 0, p = -1, j = 0,k=0,kk=0;
double A4 = 0;
for (i = 0; i < n; i++){
cin >> num;
if (num % 10 == 0){
kk++;
A1 = A1 + num;
}
if (num % 5 == 1){
j = j + 1;
p = -p;
A2 = A2 + num * p;
}
if (num % 5 == 2){
A3 = A3 + 1;
}
if (num % 5 == 3){
l = l + 1;
A4 = A4 + num;
}
if (num % 5 == 4){
k = k + 1;
if (num > A5)
A5 = num;
}
}
if (kk == 0)
printf("%s ","N");
else
printf("%d ", A1);
if (j == 0){
printf("%s ", "N");
}
else
printf("%d ", A2);
if (A3 == 0)
printf("%s ", "N");
else
printf("%d ", A3);
if (l == 0)
printf("%s ", "N");
else
printf("%.1f ", A4/l);
if (k == 0)
printf("%s", "N");
else
printf("%d", A5);
system("pause");
return 0;
}