-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompareTheTriplets.c
More file actions
56 lines (52 loc) · 1 KB
/
CompareTheTriplets.c
File metadata and controls
56 lines (52 loc) · 1 KB
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
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int* solve(int a0, int a1, int a2, int b0, int b1, int b2, int *result_size){
// Complete this function
int Atotal=0;
int Btotal=0;
if(a0 > b0){
Atotal++;
}
if(a0<b0){
Btotal++;
}
if(a1 > b1){
Atotal++;
}
if(a1<b1){
Btotal++;
}
if(a2 > b2){
Atotal++;
}
if(a2<b2){
Btotal++;
}
printf("%d %d",Atotal,Btotal);
return 0;
}
int main() {
int a0;
int a1;
int a2;
scanf("%d %d %d", &a0, &a1, &a2);
int b0;
int b1;
int b2;
scanf("%d %d %d", &b0, &b1, &b2);
int result_size;
int* result = solve(a0, a1, a2, b0, b1, b2, &result_size);
for(int result_i = 0; result_i < result_size; result_i++) {
if(result_i) {
printf(" ");
}
printf("%d", result[result_i]);
}
puts("");
return 0;
}