-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsut.c
85 lines (69 loc) · 1.34 KB
/
sut.c
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
/* sut.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "sut.h"
int max(int valueOne, int valueTwo){
if(valueOne > valueTwo){
return valueOne;
} else {
return valueTwo;
}
}
int min(int valueOne, int valueTwo){
if(valueOne < valueTwo){
return valueOne;
} else {
return valueTwo;
}
}
int combina(int* player1, int*player2) {
int d = 0;
for(int i = 0 ; LIST_END != player1[i] ; i++){
int a = player1[i];
int b = player2[i];
d += abs(a - b);
}
return d;
}
int checa_combinacao(int coworkers[7][7], int c) {
int* coworkersc = coworkers[c];
int mais_parecido = 4;
for(int i = 0 ; i < 7 ; i++){
// Combina todos os coworkers com coworker_c
// O mais parecido, ou seja, o de menor valor, serah o resultado.
}
return mais_parecido;
}
char* table(int x) {
char* res;
switch (x) {
case 5:
res = "V";
break;
default:
res = "I";
}
return res;
}
char* to_roman(int x) {
char* result;
result = malloc(100000);
if (x <= 3) {
int i;
for (i = 0; i < x; i++) {
strcat(result, "I");
}
} else {
int remainder = 5 % x;
x += remainder;
strcat(result, to_roman(remainder));
strcat(result, table(x));
}
/* printf("%d => %s\n", x, result); */
return result;
}
long square(int x) {
return (long)x*(long)x;
}