hiho Week 8 register

Ended

Participants:541

Verdict:Accepted
Score:100 / 100
Submitted:2014-08-26 14:34:35

Lang:GCC

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 <stdio.h>
#include <string.h>
#include <stdlib.h>
int n_one_bits[1 << 10];
int count_one_bits(int x) {
    int res = 0;
    while (x) {
        if (x & 1)
            ++res;
        x >>= 1;
    }
    return res;
}
void init(int total) {
    int i;
    for (i = total; i >= 0; --i)
        n_one_bits[i] = count_one_bits(i);
}
void swap(int** a, int** b) {
    int* tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}
int main(void) {
    int n, m, q, i, w, top, passanger, total, state, res;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX