hiho week 222 register

Ended

Participants:151

Verdict:Accepted
Score:100 / 100
Submitted:2018-10-06 01:11:49

Lang:G++

Edit
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
#include<iostream>
#include<stack>
#include<string.h>
#include<vector>
#include <stdio.h>
using namespace std;
const int N = 500 + 5;
char a[N][N];
int sum[N][N];
int main()
{
    int n;
    cin >> n;
    getchar();
    for(int i = 1; i <= n; i++)
    {
        gets(a[i]+1);
    }
    memset(sum,0,sizeof(sum));
    for(int i =1; i <= n; i++)
        sum[1][i] = sum[1][i-1]+a[1][i]-'0';
    for(int i = 1; i <= n; i++)
        sum[i][1] = sum[i-1][1] + a[i][1]- '0';
    for(int i = 2; i <= n; i++)
    {
        for(int j = 2; j <= n; j++)
        {
            sum[i][j] = sum[i-1][j] + sum[i][j-1] + a[i][j] - sum[i-1][j-1] - '0';
        }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX