hihoCoder太阁最新面经算法竞赛10 register

Ended

Participants:138

Verdict:Accepted
Score:100 / 100
Submitted:2016-07-28 15:23:21

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<stdio.h>
int A[6][30];
int calcNumOfOne(int num)
{
    int cnt = 0;
    while (num)
    {
        cnt++;
        num = num & (num - 1);
    }
    return cnt;
}
void show(int h, int m)
{
    
    for (int j = 1; j < A[m][0]; j++)
    {
        printf("%.2d:%.2d\n", h, A[m][j]);
    }
}
int main()
{
    int i = 0;
    for (;i < 10;i++) A[i][0] = 1;
    for (i = 0; i < 60; i++)
    {
        int cnt = calcNumOfOne(i);//1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX