-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy path1129.c
More file actions
75 lines (59 loc) · 1 KB
/
1129.c
File metadata and controls
75 lines (59 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
@autor: Malbolge;
@data: 30/10/2018;
@nome: Leitura Ótica;
*/
#include <stdio.h>
#include <stdbool.h>
char alternativaPrint(unsigned short);
void main ()
{
unsigned char alternativas[6];
unsigned short numQuestoes, i;
unsigned short contador, posicao;
bool unica;
while (true)
{
scanf("%hu", &numQuestoes);
if (numQuestoes == 0)
break;
while (numQuestoes--)
{
for (i = 0; i < 5; i++)
scanf("%hhd", &alternativas[i]);
unica = true;
contador = 0;
for (i = 0; i < 5; i++)
if (alternativas[i] <= 127)
{
contador++;
if (contador == 1 && unica == true)
{
unica = false;
posicao = i;
}
}
if (!contador)
printf("*\n");
else if (contador == 1)
printf("%c\n", alternativaPrint(posicao));
else
printf("*\n");
}
}
}
char alternativaPrint(unsigned short posicao)
{
switch (posicao) {
case 0:
return 'A';
case 1:
return 'B';
case 2:
return 'C';
case 3:
return 'D';
case 4:
return 'E';
}
}