hihoCoder Challenge 3 register

Ended

Participants:362

Verdict:Accepted
Submitted:2014-10-04 20:36:58

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 <cstdlib>
#include <cstring>
#include <cstdio>
using namespace std;
#define maxn 1005
long long f[maxn], g[maxn];
void cal(int a, long long *f)
{
    if (a == 0)
        return;
    long long x = 10;
    while (x <= a * 10)
    {
        long long count = a / x * x;
        for (int i = 0; i < 10; i++)
            f[i] += count / 10;
        int digit = a / (x / 10) % 10;
        for (int i = 0; i < digit; i++)
            f[i] += x / 10;
        f[digit] += a % (x / 10) + 1;
        if (x <= a)
            f[0] -= x;
        x *= 10;
    }
    f[0]--;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX