[Offer收割]编程练习赛1 register

Ended

Participants:955

Verdict:Accepted
Score:100 / 100
Submitted:2016-03-06 14:43:25

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 <cstdio>
#include <queue>
using namespace std;
int ans[8][9] =
{
    {4, 9, 2, 3, 5, 7, 8, 1, 6},
    {2, 7, 6, 9, 5, 1, 4, 3, 8},
    {6, 1, 8, 7, 5, 3, 2, 9, 4},
    {8, 3, 4, 1, 5, 9, 6, 7, 2},
    {2, 9, 4, 7, 5, 3, 6, 1, 8},
    {4, 3, 8, 9, 5, 1, 2, 7, 6},
    {8, 1, 6, 3, 5, 7, 4, 9, 2},
    {6, 7, 2, 1, 5, 9, 8, 3, 4},
};
int data[9];
int main()
{
    for(int i = 0; i < 9; ++i)
        scanf("%d", &data[i]);
    int flag = 0,index = 0;
    int i, j;
    for(i = 0; i < 8; ++i)
    {
        for(j = 0; j < 9; ++j)
        {
            if(data[j] != 0)
            {
                if(data[j] != ans[i][j])break;
            }
        }
        if(j >= 9)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX