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
#include<iostream>
#include<cstdio>
using namespace std;
int n,l,z;
long long w,f,s,g;
int main()
{
    cin>>n>>f;
    for(int i=1;i<n;i++)
    {
        scanf("%lld",&s);
        while(s<=f)
        {
            s*=10;w++;
            if(s<=f&&s>f-9)
            {
                g=s;
                while(g<=f)g++;
                if(g>f)s=g;
            }
        }
        if(s>1e9){l=s%10;z++;s/=10;}
        f=s;
    }
    cout<<w;
}