Added tests

This commit is contained in:
Abreu 2021-10-06 10:24:01 -03:00
parent 90d082f94f
commit 949c3a9e15
No known key found for this signature in database
GPG Key ID: 64835466FF55F7E1
3 changed files with 121 additions and 0 deletions

36
2021/1/X9.c Normal file
View File

@ -0,0 +1,36 @@
#include <stdio.h>
#include <ctype.h>
int main () {
int n = 0, i;
char c, *zion = "rx47ziny3p9b01tw2vc8kmdoqjeg5lhfsua6",
*alpha = "abcdefghijklmnopqrstuvwxyz0123456789";
for(scanf("%d\n", &n); n > 0; n--) {
do {
scanf("%c", &c);
} while (c != ' ');
while (scanf(" %c", &c) != EOF && !iscntrl(c)) {
for (i = 0; i < 36; i++)
if (c == zion[i])
break;
printf("%c", alpha[i]);
}
scanf(" ");
printf("\n");
}
return 0;
}
/*
10
ihdf9874basdbfjh9f23bhjlo ijdf0874aaswb07hxfzxbh1lx
sduhf34978hsdaf78234hbsdfogiof sdul03497vrsdff7g23w0bs8eogfxg
ghfwe978r4453kijdsf89g34kjsdfg ghofe9u8o4xuok08dvf89gx4knsdqi
5478544tr3egrwyuogy94e3lvdfyu9 5460544tg3e4rw8uony9qe3lidfyc9
aw3s4e6d5f76tg87yh5we86i afgz4e6d5f776g87ohfs8g04
sdfgrsdegerwt5gh34789thr98w7deap sd4grs8egeswtugh04a8jt0r918gdxf6
sx34wd4erv6tg7b54gfdhrt sxs7wdjexvgtw7864g4xjii
s4ed5rf6tg7yh456f8ta487 s4yd5rf7tg0yh4a6f8to4s7
zxhcvg9sergh7839r4fgwye7rga 1xhavg8sesg07736jgxfgye6ro8
fdghv92w4er8hfy34g77 l855fgffvj0a8oafe58368
*/

21
2021/1/kungfu.c Normal file
View File

@ -0,0 +1,21 @@
#include <stdio.h>
int main () {
int pares[2] = {0}, n, m, i, j, valor;
n = m = j = 0;
for (scanf("%d\n%d\n", &n, &m); n > 0; n--) {
for (i = 0; i < m; i++) {
scanf(" %d", &valor);
if (valor % 2 == 0) {
pares[j] = valor;
j = (j + 1) % 2;
printf("%d ", valor * i);
}
else
printf("%d ", pares[0] + pares[1]);
}
printf("\n");
}
return 0;
}

64
2021/1/passeio.c Normal file
View File

@ -0,0 +1,64 @@
#include <stdio.h>
int main () {
int n = 0, l1[2], l2[2];
char p1, p2;
for (scanf("%d\n", &n); n > 0; n--) {
scanf(" %d,%d %d,%d", &l1[0], &l1[1], &l2[0], &l2[1]);
if (l1[0] == 3 || l1[1] == 3 || l2[0] == 3 || l2[1] == 3){ /* casos vermelhos */
printf("A casa caiu, Cleitinho! Soca PEM neles!\n");
continue;
}
p1 = p2 = 'b';
if (l1[0] > 1 && l1[0] < 5) /* casos amarelos topo */
p1 = 'v';
else if (l1[1] > 1 && l1[1] < 5)/* casos amarelos esquerda */
p1 = 'h';
if (l2[0] > 1 && l2[0] < 5) /* casos amarelos fundo */
p2 = 'v';
else if (l2[1] > 1 && l2[1] < 5) /* casos amarelos direita */
p2 = 'h';
if (p1 == 'b' && p2 == 'b')
printf("Barra limpa, timeee\n");
else if ((p1 == 'v' && p2 == 'h') || (p1 = 'h' && p2 == 'v'))
printf("A casa caiu, Cleitinho! Soca PEM neles!\n");
else if (p1 == 'h' || p2 == 'h')
printf("Toca para horizontal, Tank.\n");
else
printf("Toca para vertical, Tank.\n");
}
return 0;
}
/* vermelho
0, 3
3, 0
6, 3
3, 6
Amarelo
0, 2
0, 4
2, 0
4, 0
6, 2
6, 4
2, 6
4, 6
hor 2-4
0,0 6,6 <- branco
0,1 5,6 <- branco
0,2 4,6 <- amarelo horizontal e vertical
0,3 3,6 <- vermelho horizonta vermelho vertical
0,4 2,6 <- amarelo vertical amarelo horizontal
0,5 1,6 < branco
0,6 0,6 <- branco
0,0 0,4 <- branco e amarelo
2,0 6,6 <- amarelo
Ambos brancos: Barra limpa, timeee
Amarelo ou vermelho horizontal ou vertical: A casa caiu, Cleitinho! Soca PEM neles!
*/