Skip to content

Commit

Permalink
10502 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
ksaveljev committed Mar 3, 2014
1 parent 4c3197a commit a790b9d
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions 10502.cpp
@@ -0,0 +1,53 @@
#include <iostream>
using namespace std;

#define pow2(i) (1<<i)
#define bit(i) (1<<i)
#define isOdd(i) (i&1)
#define isEven(i) (!(i&1))
#define sz(i) i.size()
#define REP(i, b, n) for (int i = b; i < n; i++)
#define REPI(i, b, n) for (int i = b; i <= n; i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)

int main(void) {
char board[100][100];
int row, col;

while (cin >> row) {
if (row == 0) break;

cin >> col;

int result = 0;

rep (i, row) rep (j, col) cin >> board[i][j];

rep (i, row) {
rep (j, col) {
if (board[i][j] != '1') continue;

REP (r, i, row) {
REP (c, j, col) {
bool ok = true;
REPI (a, i, r) {
REPI (b, j, c) {
if (board[a][b] != '1') {
ok = false;
a = r+1;
b = c+1;
}
}
}
if (ok) result++;
}
}
}
}

cout << result << endl;
}

return 0;
}

0 comments on commit a790b9d

Please sign in to comment.