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

Ended

Participants:955

Verdict:Accepted
Score:100 / 100
Submitted:2016-03-06 15:18:39

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 <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
int mp[9], res[9],oneCnt[1 << (9 + 1)], dp[1 << (9 + 1)],ansCnt;
int lowbit(int x)
{
    return (x & (-x));
}
int getPos(int row, int col)
{
    return (row * 3 + col);
}
bool isOK(int cur[9], int pos)
{
    int row = pos / 3;
    int col = pos % 3;
    int sum = 0;
    bool flag = false;
    for(int i = 0; i < 3; i++) {
        int num = cur[getPos(row, i)];
        if(0 == num) {
            flag = true;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX