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
32
33
34
#include <bits/stdc++.h>
using namespace std;
#define show if(0)
long long n,a,x=0,b,w;
vector <long long> V;

int main(){
  cin>>n;
  for(long long i=0;i<n;i++){
    cin>>a;
    V.push_back(a);
  }
  show
    cout<<V[0]<<endl<<"1: "<<V[0]<<endl;
  for(long long i=1;i<n;i++){
    show{
      cout<<V[i]<<endl;
    }
    b=1;
    while(V[i]<=V[i-1]){
      V[i]*=10;
      b*=10;
      x++;
      if(V[i]+b-1>V[i-1])
        while(V[i]<=V[i-1])
          V[i]++;
    }
    show{
      cout<<"  b: "<<b<<endl<<i+1<<": "<<V[i]<<endl;
    }
  }
  cout<<x<<endl;
  return 0;
}