TOPIC

10% de erro

João Pedro Sanches Dovichi asked 1 year ago

Subi meu código, mas recebi 10% de erro, como proceder?

include include

void main() { int cases, cas;

scanf ("%i", &cases);

for (cas = 0; cas < cases; cas++)
{
    int matrix [9][9];
    int i,j;
    int sum = 0;
    int flag;

    for (int i = 0; i < 9; i++)
    {
        for (int j = 0; j < 9; j++)
        {
            scanf ("%i", &matrix[i][j]);
        }
    }

    for (int i = 0; i < 9; i++)
    {
        for (int j = 0; j < 9; j++)
        {
            sum = sum + matrix[i][j];
        }

        if (sum > 45)
        {
            flag = 1;
        }

        sum = 0;
    }

    for (int j = 0; j < 9; j++)
    {
        for (int i = 0; i < 9; i++)
        {
            sum = sum + matrix[i][j];
        }

        if (sum > 45)
        {
            flag = 1;
        }

        sum = 0;
    }

    if (flag == 0)
    {
        printf ("Instancia %i\n", cas + 1);
        printf ("SIM\n");
    }
    else
    {
        printf ("Instancia %i\n", cas + 1);
        printf ("NAO\n");
    }

    flag = 0;

}

}

Remember not post solutions. Your post may be reviewed by our moderators.