Skip to content

Commit

Permalink
aaa
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanCruz committed Oct 18, 2019
1 parent cfa962e commit 0c50add
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 0 deletions.
73 changes: 73 additions & 0 deletions claudio/comp1/balao.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include <bits/stdc++.h>

#define MAX 2000

using namespace std;


int main (void ) {
int caixa[10][10];


while(true){
int l, c, p;
memset(caixa, 0, sizeof caixa);
scanf("%d %d %d", &l, &c, &p);

if (l == 0 && c == 0 && p == 0) break;

for (int i = 0; i < l; i++) {
for (int j = 0; j < c; j++) {
scanf("%d", &caixa[i][j]);
}
}

bool r = true;
int i;
p--;
for (i = 0; i < l; i++) {
int orig_p = p;

if(caixa[i][p]) {
r = false;
i--;
break;
}


for (int j = p-1; j >= 0; j--) {
if (caixa[i][j] > 0) {
p += caixa[i][j];
break;
}
}

for (int j = orig_p+1; j < c; j++) {
if (caixa[i][j] > 0) {
p -= caixa[i][j];
break;
}
}

int min_left = p < orig_p ? p : orig_p;
int max_right = p > orig_p ? p : orig_p;

for (int j = min_left; j <= max_right; j++) {
if (caixa[i][j] > 0) {
r = false;
break;
}
}

if (!r) break;
}

if (r) {
printf("OUT %d\n", p);
} else {
printf("BOOM %d %d\n", i+1, p);
}
}

return 0;
}
18 changes: 18 additions & 0 deletions claudio/comp1/conta.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <bits/stdc++.h>

using namespace std;

int main (void ) {
int t;
scanf("%d", &t);

while(t--) {
int n;
scanf("%d", &n);

if (n % 2) printf("1\n");
else (printf("0\n"));
}

return 0;
}
10 changes: 10 additions & 0 deletions claudio/comp1/ib
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
4 7 6
3 0 0 0 0 0 5
2 0 0 0 0 0 4
1 0 1 0 0 0 1
3 0 0 0 1 0 1
3 3 2
1 0 1
1 0 1
2 0 1
0 0 0
19 changes: 19 additions & 0 deletions claudio/comp1/mjolnir.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <bits/stdc++.h>

using namespace std;

int main (void ) {
int n;
char name[10000];

scanf("%d", &n);

while (n--) {
scanf("%s %*d", name);

if (strcmp(name, "Thor")) printf("N\n");
else printf("Y\n");
}

return 0;
}
40 changes: 40 additions & 0 deletions claudio/comp1/pedrapapeltesoura.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <bits/stdc++.h>

#define n_rules 10

using namespace std;

string rules[n_rules] = {"tesoura papel", "papel pedra", "pedra lagarto", "lagarto spock", "spock tesoura", "tesoura lagarto", "lagarto papel", "papel spock", "spock pedra", "pedra tesoura"};

char l1[1000];
char l2[1000];

char scenario1[1000], scenario2[1000];


int main (void ) {
int t;
scanf("%d", &t);

while(t--) {
scanf("%s %s", l1, l2);

string winner = "empate";

for (auto rule : rules) {

sprintf(scenario1, "%s %s", l1, l2);
sprintf(scenario2, "%s %s", l2, l1);

if (strcmp(rule.c_str(), scenario1) == 0) {
winner = "rajesh";
} else if (strcmp(rule.c_str(), scenario2) == 0) {
winner = "sheldon";
}
}

printf("%s\n", winner.c_str());
}

return 0;
}
26 changes: 26 additions & 0 deletions claudio/comp1/qq11
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
4 7 6
3 0 0 0 0 0 5
2 0 0 0 0 0 4
2 0 1 0 0 0 1
3 0 0 0 1 0 1
4 7 6
3 0 0 0 0 0 5
2 0 0 0 0 0 3
2 0 1 0 0 0 1
3 0 0 0 1 0 1
4 7 6
3 0 0 0 0 0 55
2 0 0 0 0 0 4
2 0 1 0 0 0 1
3 0 0 0 1 0 1
4 7 6
0 0 0 0 0 0 5
2 0 0 0 0 0 3
2 0 1 0 0 0 1
3 0 0 0 1 0 1
4 7 6
1 0 0 0 0 0 0
2 0 0 0 0 0 3
2 0 1 0 0 0 1
3 0 0 0 1 0 1
0 0 0
37 changes: 37 additions & 0 deletions claudio/comp1/sansa.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <bits/stdc++.h>

#define MAX 2000

using namespace std;

int heights[MAX];

bool verify(int a, int b, int k) {
int count = 0;
int i = 0;
while (i <= b) {
while (i <= b && heights[i] <= heights[i+1]) i++;
if (i - a == 0) break;

count++;

a = i;
while (i <= b && heights[i] >= heights[i+1]) i++;
if (i - a == 0) break;
}

return count == k;
}

int main (void ) {
int n, k;
scanf("%d %d", &n, &k);

for (int i = 0; i < MAX; i++) {
scanf("%d", heights+i);
}

printf(verify(0, n-1, k) ? "beautiful\n" : "ugly\n");

return 0;
}
32 changes: 32 additions & 0 deletions claudio/comp1/zero.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <bits/stdc++.h>

#define MAX 2000

using namespace std;

int main (void ) {
int n1, n2;
int v[20];

while (true) {
scanf("%d %d", &n1, &n2);
if (n1 == 0 && n2 == 0) break;

int v_i = 20;
int r = n1 + n2;

while (r > 0) {
if (r % 10) {
v[v_i--] = r%10;
}

r /= 10;
}

for (int i = v_i+1; i <= 20; i++) {
printf("%d", v[i]);
}
printf("\n");
}
return 0;
}

0 comments on commit 0c50add

Please sign in to comment.