Skip to content

Instantly share code, notes, and snippets.

@m4scosta
Created April 3, 2015 00:17
Show Gist options
  • Save m4scosta/b6b939f0cb378bab810a to your computer and use it in GitHub Desktop.
Save m4scosta/b6b939f0cb378bab810a to your computer and use it in GitHub Desktop.
10% de WA!! ajuda aee!
#include <iostream>
#include <cstring>
#define MAX 101
using namespace std;
int main()
{
int n, m, x;
int matriz[MAX][MAX];
int caracteristicas;
int problemas[MAX];
int participantes[MAX];
while ((cin >> n >> m) && n && m)
{
caracteristicas = 0;
memset(problemas, 0, sizeof(problemas));
memset(participantes, 0, sizeof(participantes));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
cin >> x;
problemas[i] += x;
participantes[j] += x;
}
}
// PRIMEIRA CARACTERISTICA
int resolveu_todos = 0;
for (int i = 0; i < n; i++) {
if (participantes[i] == m)
resolveu_todos = 1;
}
if (!resolveu_todos) caracteristicas++;
// FIM DA PRIMEIRA CARACTERISTICA
// SEGUNDA CARACTERISTICA
int todos_resolvidos = 1;
for (int i = 0; i < m; i++) {
if (problemas[i] == 0)
todos_resolvidos = 0;
}
if (todos_resolvidos) caracteristicas++;
// FIM DA SEGUNDA CARACTERISTICA
// TERCEIRA CARACTERISTICA
int resolvido_por_todos = 0;
for (int i = 0; i < m; i++) {
if (problemas[i] == n)
resolvido_por_todos = 1;
}
if (!resolvido_por_todos) caracteristicas++;
// FIM DA TERCEIRA CARACTERISTICA
// QUARTA CARACTERISTICA
int todos_resolveram = 1;
for (int i = 0; i < n; i++) {
if (participantes[i] == 0)
todos_resolveram = 0;
}
if (todos_resolveram) caracteristicas++;
// FIM DA QUARTA CARACTERISTICA
cout << caracteristicas << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment